diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7a527a3..b606e9e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -66,7 +66,7 @@ jobs: run: nf-core -l lint_log.txt pipelines lint --release --dir ${GITHUB_WORKSPACE} --markdown lint_results.md - name: Save PR number - if: ${{ always() }} + if: ${{ always() && github.event.pull_request.number }} run: echo ${{ github.event.pull_request.number }} > PR_number.txt - name: Upload linting log file artifact diff --git a/.github/workflows/linting_comment.yml b/.github/workflows/linting_comment.yml index dd8c035..cb5232a 100644 --- a/.github/workflows/linting_comment.yml +++ b/.github/workflows/linting_comment.yml @@ -21,17 +21,20 @@ jobs: id: pr_number run: | if [ ! -f linting-logs/PR_number.txt ]; then - echo "PR number file not found" - exit 1 + echo "No PR number file found (not a PR event), skipping comment" + echo "skip=true" >> $GITHUB_OUTPUT + exit 0 fi PR_NUM=$(cat linting-logs/PR_number.txt) if ! [[ "$PR_NUM" =~ ^[0-9]+$ ]]; then - echo "Invalid PR number: $PR_NUM" - exit 1 + echo "Invalid PR number: $PR_NUM, skipping comment" + echo "skip=true" >> $GITHUB_OUTPUT + exit 0 fi echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT - name: Post PR comment + if: ${{ steps.pr_number.outputs.skip != 'true' }} uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.nf-core.yml b/.nf-core.yml index e62b86d..2dcf9f0 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -10,6 +10,7 @@ lint: - .github/PULL_REQUEST_TEMPLATE.md - .github/CONTRIBUTING.md - .github/workflows/branch.yml + - .github/workflows/linting.yml - .github/workflows/linting_comment.yml - .github/.dockstore.yml - docs/README.md