Fix: add allowed-files to safe-outputs for node and github-actions workflows#1071
Merged
Conversation
The repository has no COPILOT_TOKEN secret. gh-aw looks for COPILOT_GITHUB_TOKEN by default so the engine.env mapping was unnecessary. Removing it also removes the need for --approve on compile. Requires a COPILOT_GITHUB_TOKEN repository secret to be created: a fine-grained PAT with the 'Copilot Requests' permission. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The node and github-actions dependency-update workflows were failing at the safe-outputs step because package.json / pnpm-lock.yaml and .github/workflows/*.yml are in safe-outputs' default protected-files list. Add explicit allowed-files entries so the agent can create PRs that modify those files — which is the entire purpose of these workflows. - dependency-update-node.md: allow **/package.json, **/pnpm-lock.yaml, **/package-lock.json, **/yarn.lock, **/.npmrc - dependency-update-github-actions.md: allow .github/workflows/*.yml/yaml and .github/actions/**/*.yml/yaml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes Copilot gh-aw dependency-update workflows failing during the Safe Outputs “create pull request” step by explicitly allowlisting the protected files that these workflows are expected to modify.
Changes:
- Add
allowed-filesallowlists tosafe-outputs.create-pull-requestfor the Node dependency update workflow. - Add
allowed-filesallowlists tosafe-outputs.create-pull-requestfor the GitHub Actions dependency update workflow. - Regenerate the corresponding
*.lock.ymlcompiled workflow files to reflect the updated Safe Outputs configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/dependency-update-node.md | Adds allowed-files patterns for Node lockfiles/manifests so Safe Outputs permits intended edits. |
| .github/workflows/dependency-update-node.lock.yml | Compiled lockfile updated to include allowed_files in the generated Safe Outputs config. |
| .github/workflows/dependency-update-github-actions.md | Adds allowed-files patterns for workflow/action YAML updates so Safe Outputs permits intended edits. |
| .github/workflows/dependency-update-github-actions.lock.yml | Compiled lockfile updated to include allowed_files in the generated Safe Outputs config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
The node and github-actions dependency-update workflows fail at the safe-outputs step with:
The safe-outputs system has a built-in protected-files list that blocks PRs touching sensitive files. These need to be explicitly allowlisted since modifying them is the purpose of each workflow.
Root cause
package.jsonandpnpm-lock.yamlare protected by default.github/workflows/*.ymlfiles are protected by defaultFix
Added
allowed-filestosafe-outputs.create-pull-requestin each source file:dependency-update-node.md:**/package.json,**/pnpm-lock.yaml,**/package-lock.json,**/yarn.lock,**/.npmrcdependency-update-github-actions.md:.github/workflows/*.yml,.github/workflows/*.yaml,.github/actions/**/*.yml,.github/actions/**/*.yamlNote
The dotnet workflow (which passed) doesn't need this fix because
.csproj,Directory.Packages.propsetc. are not in the default protected-files list.