File tree Expand file tree Collapse file tree 1 file changed +35
-4
lines changed
Expand file tree Collapse file tree 1 file changed +35
-4
lines changed Original file line number Diff line number Diff line change 11name : hCaptcha CI
22on : [ push, pull_request ]
3+
4+ # 1. SECURITY: Default to read-only permissions for the workflow
5+ permissions :
6+ actions : read
7+ contents : read
8+
39concurrency :
410 group : ${{ github.ref }}
511 cancel-in-progress : true
3541 with :
3642 path : ${{ env.wp-plugin-directory }}
3743
38- - name : Update changelog
39- if : ${{ matrix.php-version == '8.4' }}
40- working-directory : ${{ env.wp-plugin-directory }}
41- run : .github/scripts/update-changelog.sh
44+ # MOVED: The "Update changelog" step has been moved to the specific job below
45+ # to prevent giving 'contents: write' permissions to this testing job.
4246
4347 - name : Setup PHP
4448 uses : hCaptcha/setup-php@42a9487ddd45db247decea2acf7de871a8178226
@@ -115,3 +119,30 @@ jobs:
115119 if : ${{ matrix.php-version == '8.4' }}
116120 working-directory : ${{ env.wp-plugin-directory }}
117121 run : yarn jest
122+
123+ update_changelog :
124+ name : Update Changelog
125+ runs-on : ubuntu-latest
126+
127+ # 2. SECURITY: Only run on PUSH, never on Pull Requests
128+ if : github.event_name == 'push'
129+ needs : cs_and_tests
130+
131+ # 3. SECURITY: Grant write permission ONLY to this job
132+ permissions :
133+ contents : write
134+
135+ env :
136+ wp-plugin-directory : wordpress/wp-content/plugins/hcaptcha-wordpress-plugin
137+
138+ steps :
139+ - name : Checkout code
140+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
141+ with :
142+ path : ${{ env.wp-plugin-directory }}
143+ # Check out the branch ref to ensure we can push back to it
144+ ref : ${{ github.ref }}
145+
146+ - name : Update changelog
147+ working-directory : ${{ env.wp-plugin-directory }}
148+ run : .github/scripts/update-changelog.sh
You can’t perform that action at this time.
0 commit comments