-
Notifications
You must be signed in to change notification settings - Fork 5
fix: inherit secrets #1095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: inherit secrets #1095
Conversation
|
Preview (prod backend + PR dashboard) → https://1095.ns-preview.trapti.tech/ |
| runs-on: ubuntu-latest | ||
| needs: [ release ] | ||
| steps: | ||
| - uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.DISPATCH_PAT }} | ||
| script: | | ||
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'traPtitech', | ||
| repo: 'manifest', | ||
| workflow_id: 'renovate.yaml', | ||
| ref: 'main' | ||
| }) |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the problem, you should add a permissions block to the workflow file, specifying only the permissions required for the jobs. The best way is to add the block at the top level of the workflow, so it applies to all jobs unless overridden. For this workflow, the release job needs to push commits and publish packages, so it requires contents: write and possibly packages: write. The dispatch-renovate job uses a personal access token (DISPATCH_PAT) to dispatch another workflow, but does not use GITHUB_TOKEN for any privileged operation, so it can be set to none or left as is. However, for clarity and security, it's best to set the minimal permissions at the workflow level, and override per job if needed.
You should add the following block near the top of the file, after the name and run-name fields:
permissions:
contents: write
packages: writeIf you want to be even more restrictive, you can set permissions: {} at the workflow level and add the required permissions only to the release job. For simplicity and clarity, the above is sufficient.
-
Copy modified lines R3-R5
| @@ -1,5 +1,8 @@ | ||
| name: Release helm chart | ||
| run-name: Release helm chart (${{ inputs.strategy }}) | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| on: | ||
| workflow_dispatch: |
|
helmのmain直pushが失敗しているのはどうしよう...
Deploy keyをbypassできる設定があるみたいなので、適当な Actionsのマシンの |
|
あとは一旦手元から ./publish.sh できないこともないです |
|
一番安全とされる方法はGitHub Appだけども、インストールとかが超めんどくさいのでお好みで |
一旦これで対応しようと思います |
こんな感じでいけました~ deploy keyをwrite accessありでリポジトリに登録 before: https://github.com/motoki317/actions-test/actions/runs/16961877345/job/48076409522 |

なぜやるか
https://github.com/traPtitech/NeoShowcase/actions/runs/16960526932/job/48072361393
やったこと
やらなかったこと
helm用の直pushが失敗している
#1095 (comment)
資料