{CI} Tighten GHA workflows' permission#33477
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce GitHub Actions privilege exposure by replacing pull_request_target with pull_request across several workflows and tightening GITHUB_TOKEN permissions to the minimum required.
Changes:
- Switched multiple workflows from
pull_request_targettopull_request. - Added/adjusted workflow/job-level
permissions(often defaulting to none viapermissions: {}and granting only what a job needs). - Changed
GitHookNoticebehavior from posting a PR comment to only printing the notice in workflow logs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/GitHookNotice.yml | Switches to pull_request, scopes permissions, and replaces PR commenting with log output. |
| .github/workflows/CCOA.yml | Switches to pull_request and moves write permissions to the job level for PR commenting. |
| .github/workflows/BlockPRMerge.yml | Switches to pull_request and explicitly removes token permissions. |
| .github/workflows/AzdevStyle.yml | Switches to pull_request (permissions already scoped at job level). |
| .github/workflows/AzdevLinter.yml | Switches to pull_request (permissions already scoped at job level). |
| .github/workflows/AddPRComment.yml | Switches to pull_request while still relying on a repository secret to comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| on: | ||
| pull_request_target: | ||
| pull_request: | ||
| types: [opened] |
| on: | ||
| pull_request_target: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| branches: | ||
| - dev |
| - name: Show git hook notice | ||
| run: | | ||
| echo "::group::Git hook notice" | ||
| cat .github/template/git-hooks-note.md | ||
| echo "::endgroup::" |
Related command
Description
Replaced
pull_request_targetwithpull_requestacross 6 workflows and scoped permissions to the minimum required.Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.