Skip to content

Add scheduled Dependabot auto-fix workflow using Copilot CLI#1558

Merged
priyanshu92 merged 2 commits intomainfrom
users/priyanshuag/dependabot-autofix-workflow
Apr 23, 2026
Merged

Add scheduled Dependabot auto-fix workflow using Copilot CLI#1558
priyanshu92 merged 2 commits intomainfrom
users/priyanshuag/dependabot-autofix-workflow

Conversation

@priyanshu92
Copy link
Copy Markdown
Contributor

Summary

Adds .github/workflows/dependabot-autofix.yml that runs weekly (Mondays 06:00 UTC) and on workflow_dispatch to:

  1. Enumerate open Dependabot alerts.
  2. Invoke the fix-dependabot-alerts skill via GitHub Copilot CLI.
  3. Run npm run build + npm test to verify fixes.
  4. Open a single consolidated PR with all fixes.

Auth model (matches existing workflows)

Purpose Token
git push, gh pr create Existing GitHub App (app-id 2740120, secret POWER_PAGES_PUBLIC_GITHUB_APP_PRIVATE_KEY) via actions/create-github-app-token@v1 — same pattern as loc-update.yml / translations-export.yml
Copilot CLI auth + Dependabot alert reads Fine-grained PAT in new secret COPILOT_CLI_PAT (App tokens cannot authenticate Copilot CLI since Copilot licenses are per-user)

Hardening

  • Narrow --allow-tool grants: shell(npm:*), shell(npx:*), shell(gh:*), shell(git:*), shell(node:*), write, read. No --allow-all, no --share-gist.
  • --secret-env-vars=COPILOT_CLI_PAT redacts the PAT from logs.
  • --no-ask-user prevents the agent from blocking CI.
  • --model claude-sonnet-4.6 pinned for reproducibility.
  • Agent skips push/PR when build or tests fail, and no-ops when there are zero open alerts.
  • concurrency: dependabot-autofix with cancel-in-progress: false.
  • Session transcript uploaded as workflow artifact (14-day retention).

One-time setup needed before the workflow can run

  1. Add repo secret COPILOT_CLI_PAT — fine-grained PAT from a Copilot-licensed user with:
    • Account: Copilot Requests: Read
    • Repository: Dependabot alerts: Read
  2. Confirm the existing GitHub App installation on this repo still has Contents: Read/Write and Pull requests: Read/Write (already required by existing workflows).

References

Adds .github/workflows/dependabot-autofix.yml that runs weekly (and on
workflow_dispatch) to invoke the fix-dependabot-alerts skill via GitHub
Copilot CLI, apply fixes, run build + tests, and open a single
consolidated PR.

Auth model matches existing workflows:
- GitHub App (app-id 2740120, POWER_PAGES_PUBLIC_GITHUB_APP_PRIVATE_KEY)
  is used for checkout, git push, and gh pr create so commits and the
  PR are authored by github-actions[bot].
- A fine-grained PAT in COPILOT_CLI_PAT is used only for Copilot CLI
  auth and Dependabot alert enumeration (App tokens cannot authenticate
  Copilot CLI since Copilot licenses are per-user).

Hardening:
- Narrow --allow-tool grants; no --allow-all, no --share-gist.
- --secret-env-vars redacts the PAT from logs.
- --no-ask-user prevents the agent from blocking CI.
- --model pinned to claude-sonnet-4.6 for reproducibility.
- Agent is instructed to skip push/PR when npm build or tests fail,
  and to no-op when there are zero open alerts.
- concurrency group with cancel-in-progress: false.
- Session transcript uploaded as a workflow artifact (14-day retention).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@priyanshu92 priyanshu92 requested review from a team as code owners April 23, 2026 06:25
@priyanshu92 priyanshu92 enabled auto-merge (squash) April 23, 2026 06:34
@priyanshu92 priyanshu92 merged commit 1e66d90 into main Apr 23, 2026
9 checks passed
@priyanshu92 priyanshu92 deleted the users/priyanshuag/dependabot-autofix-workflow branch April 23, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants