fix: use CREATE_PR_PAT for agentic workflows in Microsoft org#144
Merged
sergio-sisternes-epam merged 2 commits intomainfrom Mar 3, 2026
Merged
fix: use CREATE_PR_PAT for agentic workflows in Microsoft org#144sergio-sisternes-epam merged 2 commits intomainfrom
sergio-sisternes-epam merged 2 commits intomainfrom
Conversation
GitHub Actions GITHUB_TOKEN cannot create PRs in the Microsoft org. Add github-token secret to safe-outputs in daily-test-improver and daily-doc-updater workflows, then recompile via gh aw compile. Fixes #143
Contributor
There was a problem hiding this comment.
Pull request overview
Updates gh-aw “agentic” workflows to use a fine-grained PAT (CREATE_PR_PAT) for PR-creation related operations, addressing Microsoft org restrictions that prevent GITHUB_TOKEN from creating/approving PRs.
Changes:
- Add
safe-outputs.github-token: ${{ secrets.CREATE_PR_PAT }}to the Daily Test Improver and Daily Documentation Updater workflow sources. - Recompiled gh-aw workflows so the generated
.lock.ymlworkflows consistently useCREATE_PR_PATand redact it. - Regenerated gh-aw maintenance workflow and updated the actions lockfile to include the new gh-aw setup action pin.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/daily-test-improver.md | Configures safe-outputs to use CREATE_PR_PAT for workflow GitHub operations. |
| .github/workflows/daily-test-improver.lock.yml | Generated workflow updated to use CREATE_PR_PAT in relevant steps and redaction config. |
| .github/workflows/daily-doc-updater.md | Configures safe-outputs to use CREATE_PR_PAT for PR creation. |
| .github/workflows/daily-doc-updater.lock.yml | Generated workflow updated to use CREATE_PR_PAT in relevant steps and redaction config. |
| .github/workflows/agentics-maintenance.yml | Regenerated maintenance workflow (gh-aw v0.52.1) including new manual operation dispatch path. |
| .github/aw/actions-lock.json | Adds pinned SHA entry for github/gh-aw/actions/setup@v0.52.1. |
Comments suppressed due to low confidence (5)
.github/workflows/daily-test-improver.md:35
- This hard-requires the
CREATE_PR_PATsecret and drops the existing fallback token chain used by other gh-aw workflows in this repo (e.g.secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN). Consider makingCREATE_PR_PATthe first option but keeping a fallback (PAT-first) so the workflow still runs in environments where the secret isn’t configured yet, while still fixing the Microsoft org restriction.
safe-outputs:
github-token: ${{ secrets.CREATE_PR_PAT }}
add-comment:
.github/workflows/daily-test-improver.md:34
- This workflow now depends on a new repo secret (
CREATE_PR_PAT) to function in Microsoft orgs. Per the docs-up-to-date guideline, please add a short note in thedocs/documentation (e.g., under the GitHub Actions authentication section) explaining whenCREATE_PR_PATis required and the minimal permissions it needs.
safe-outputs:
github-token: ${{ secrets.CREATE_PR_PAT }}
.github/workflows/daily-doc-updater.md:34
- Same as daily-test-improver: consider making this PAT-first but not PAT-only. Keeping a fallback chain (CREATE_PR_PAT → existing GH_AW_* secrets → GITHUB_TOKEN) matches the pattern in other compiled gh-aw workflows in this repo and avoids hard failures when the secret isn’t configured yet.
safe-outputs:
github-token: ${{ secrets.CREATE_PR_PAT }}
create-pull-request:
.github/workflows/daily-doc-updater.md:34
- Please document the new
CREATE_PR_PATprerequisite indocs/(recommended location: the GitHub Actions auth section) so maintainers know how to configure the secret and whyGITHUB_TOKENis insufficient in the Microsoft org.
safe-outputs:
github-token: ${{ secrets.CREATE_PR_PAT }}
create-pull-request:
.github/workflows/agentics-maintenance.yml:103
- This recompile introduces new behavior beyond the CREATE_PR_PAT change: a
workflow_dispatchinput plus a newrun_operationjob withactions: write/contents: write/pull-requests: writepermissions that can rundisable|enable|update|upgrade. If this is intended, it should be called out explicitly in the PR description; if it’s unintended, consider compiling with the prior gh-aw version or splitting this into a separate PR for review.
schedule:
- cron: "37 */6 * * *" # Every 6 hours (based on minimum expires: 2 days)
workflow_dispatch:
inputs:
operation:
description: 'Optional maintenance operation to run'
required: false
type: choice
default: ''
options:
- ''
- 'disable'
- 'enable'
- 'update'
- 'upgrade'
permissions: {}
jobs:
close-expired-entities:
if: ${{ !github.event.repository.fork && (github.event_name != 'workflow_dispatch' || github.event.inputs.operation == '') }}
runs-on: ubuntu-slim
permissions:
discussions: write
issues: write
pull-requests: write
steps:
- name: Setup Scripts
uses: github/gh-aw/actions/setup@a86e657586e4ac5f549a790628971ec02f6a4a8f # v0.52.1
with:
destination: /opt/gh-aw/actions
- name: Close expired discussions
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io);
const { main } = require('/opt/gh-aw/actions/close_expired_discussions.cjs');
await main();
- name: Close expired issues
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io);
const { main } = require('/opt/gh-aw/actions/close_expired_issues.cjs');
await main();
- name: Close expired pull requests
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io);
const { main } = require('/opt/gh-aw/actions/close_expired_pull_requests.cjs');
await main();
run_operation:
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.operation != '' && !github.event.repository.fork }}
runs-on: ubuntu-slim
permissions:
actions: write
contents: write
pull-requests: write
steps:
sergio-sisternes-epam
approved these changes
Mar 3, 2026
danielmeppiel
added a commit
to microsoft/homebrew-apm
that referenced
this pull request
Mar 9, 2026
- Formula: update to v0.7.5 with correct SHA256 checksums - Workflow: replace github.token with secrets.CREATE_PR_PAT for PR creation The default GITHUB_TOKEN cannot push branches or create PRs in Microsoft org repos due to org-level policy restrictions. This is the same fix applied to the apm repo itself (microsoft/apm#144).
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
Fixes #143 — Daily Test Improver (and Daily Doc Updater) fail with
create_pull_request: GitHub Actions is not permitted to create or approve pull requestsbecause the Microsoft org blocksGITHUB_TOKENfrom creating PRs.Changes
github-token: ${{ secrets.CREATE_PR_PAT }}tosafe-outputsgithub-token: ${{ secrets.CREATE_PR_PAT }}tosafe-outputsgh aw compilePrerequisites
A fine-grained PAT stored as the
CREATE_PR_PATrepository secret with these permissions onmicrosoft/apm: