From 7601371e8829dfd8408905c8f3a56c4d1af03222 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Mon, 6 Apr 2026 09:58:12 +0100 Subject: [PATCH 1/2] fix: skip linting comment when triggered by release events The linting workflow triggers on both pull_request and release events. On release events, github.event.pull_request.number is empty, causing PR_number.txt to contain an invalid value and the comment workflow to fail. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/linting.yml | 2 +- .github/workflows/linting_comment.yml | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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 }} From 2a88236ebe9bb55e1cc3cdee8243713d7124bbe2 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Mon, 6 Apr 2026 10:01:50 +0100 Subject: [PATCH 2/2] fix: exclude linting.yml from nf-core files_unchanged check Co-Authored-By: Claude Opus 4.6 (1M context) --- .nf-core.yml | 1 + 1 file changed, 1 insertion(+) 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