33 issue_comment :
44 types : [created] # Add "@nf-core-bot changelog" as a PR comment to trigger this workflow.
55
6+ permissions : {}
7+
68jobs :
79 update_changelog :
810 runs-on : ubuntu-latest
9- if : contains(github.event.comment.body, '@nf-core-bot changelog')
11+ if : >
12+ github.event.issue.pull_request &&
13+ contains(github.event.comment.body, '@nf-core-bot changelog')
1014
1115 steps :
12- - name : branch-deploy
13- id : branch-deploy
14- if : github.event_name == 'issue_comment'
15- uses : github/branch-deploy@fded0351b6b79f854b335c11b3d93063461dd288 # v11.1.2
16- with :
17- trigger : " @nf-core-bot changelog"
18- reaction : " eyes"
19- stable_branch : " dev"
16+ - name : Verify commenter is on the nf-core/infrastructure team
17+ env :
18+ GH_TOKEN : ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
19+ ACTOR : ${{ github.event.comment.user.login }}
20+ run : |
21+ state=$(gh api "orgs/nf-core/teams/infrastructure/memberships/${ACTOR}" --jq '.state' 2>/dev/null || true)
22+ if [ "$state" != "active" ]; then
23+ echo "::error::@${ACTOR} is not an active member of nf-core/infrastructure; refusing to run."
24+ exit 1
25+ fi
26+ echo "@${ACTOR} is on nf-core/infrastructure — proceeding."
27+
28+ - name : React to the triggering comment
29+ env :
30+ GH_TOKEN : ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
31+ run : |
32+ gh api --method POST \
33+ "repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \
34+ -f content=eyes
2035
21- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36+ # Checks out the base ref (the trusted version of the repo) first.
37+ - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2238 with :
2339 token : ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
2440
25- # Action runs on the issue comment, so we don't get the PR by default.
26- # Use the GitHub CLI to check out the PR:
41+ - name : Save trusted scripts
42+ run : |
43+ cp "${GITHUB_WORKSPACE}/.github/workflows/changelog.py" "${RUNNER_TEMP}/changelog.py"
44+ cp "${GITHUB_WORKSPACE}/.pre-commit-config.yaml" "${RUNNER_TEMP}/pre-commit-config.yaml"
45+
2746 - name : Checkout Pull Request
2847 env :
2948 GH_TOKEN : ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
3049 run : |
3150 PR_NUMBER="${{ github.event.issue.number }}"
3251 gh pr checkout $PR_NUMBER
3352
34- - uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
53+ - uses : actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
3554 with :
3655 python-version : " 3.14"
3756
@@ -45,30 +64,31 @@ jobs:
4564 PR_NUMBER : ${{ github.event.issue.number || github.event.pull_request.number }}
4665 PR_TITLE : ${{ github.event.issue.title || github.event.pull_request.title }}
4766 run : |
48- python ${GITHUB_WORKSPACE}/.github/workflows/ changelog.py
67+ python "${RUNNER_TEMP}/ changelog.py"
4968
5069 - name : Check if CHANGELOG.md actually changed
5170 id : file_changed
5271 run : |
5372 # Show the diff for debugging
54- git diff -- ${GITHUB_WORKSPACE}/CHANGELOG.md
73+ git diff -- " ${GITHUB_WORKSPACE}/CHANGELOG.md"
5574
5675 # Check if file has unstaged changes
57- [ -n "$(git diff -- ${GITHUB_WORKSPACE}/CHANGELOG.md)" ] && file_changed="TRUE" || file_changed="FALSE"
76+ [ -n "$(git diff -- " ${GITHUB_WORKSPACE}/CHANGELOG.md" )" ] && file_changed="TRUE" || file_changed="FALSE"
5877
5978 echo "File changed: $file_changed"
60- echo "changed=$file_changed" >> $GITHUB_OUTPUT
79+ echo "changed=$file_changed" >> " $GITHUB_OUTPUT"
6180
6281 - name : Set up Python 3.14
63- uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
82+ uses : actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
6483 with :
6584 python-version : " 3.14"
6685
6786 - name : Run pre-commit rules with prek
68- uses : j178/prek-action@6ad80277337ad479fe43bd70701c3f7f8aa74db3 # v2
87+ if : steps.file_changed.outputs.changed == 'TRUE'
88+ uses : j178/prek-action@5337cb91e0fa35a7ff31b9ca345126d8bbbcdf16 # v2
6989 continue-on-error : true
7090 with :
71- extra-args : --config . pre-commit-config.yaml --all- files
91+ extra-args : --config ${{ runner.temp }}/ pre-commit-config.yaml --files CHANGELOG.md
7292
7393 - name : Commit and push changes
7494 if : steps.file_changed.outputs.changed == 'TRUE'
7797 run : |
7898 git config user.email "core@nf-co.re"
7999 git config user.name "nf-core-bot"
80- git add ${GITHUB_WORKSPACE}/CHANGELOG.md
100+ git add " ${GITHUB_WORKSPACE}/CHANGELOG.md"
81101 git status
82102 git commit -m "[automated] Update CHANGELOG.md [skip ci]"
83103 git push
0 commit comments