17
permissions:
18
contents: write
19
pull-requests: write
20
+ id-token: write
21
22
steps:
23
+ # `GITHUB_TOKEN` cannot open pull requests here: the repository has
24
+ # "Allow GitHub Actions to create and approve pull requests" disabled, so
25
+ # `createPullRequest` is rejected no matter what `pull-requests` grants.
26
+ # Every other PR-opening workflow in this repo mints a release-bot App
27
+ # token for exactly this reason.
28
+ - name: Generate GitHub App token
29
+ id: app-token
30
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
31
+ with:
32
+ client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
33
+ private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
34
+
35
- name: Checkout repository
36
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37
with:
38
+ token: ${{ steps.app-token.outputs.token }}
39
fetch-depth: 0
40
41
- name: Detect new changelog files
76
5. If no docs changes are needed, make no file changes and explain why
77
78
- name: Create PR if docs changed
79
+ id: create-pr
80
if: steps.detect.outputs.found == 'true'
81
env:
67
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
83
run: |
84
if [ -z "$(git status --porcelain)" ]; then
85
echo "No documentation changes needed"
94
git commit -m "docs: update documentation for new changelog entries"
95
git push -u origin "$BRANCH"
96
82
- gh pr create \
97
+ # Requesting the reviewer is deliberately NOT part of this call: an
98
+ # unassignable actor (bot account, non-collaborator) would fail the
99
+ # whole command after the branch is already pushed, leaving an orphan
100
+ # branch and no PR. It runs as a separate best-effort step below.
101
+ PR_URL=$(gh pr create \
102
--base next \
103
--head "$BRANCH" \
104
--title "docs: update documentation for new changelog entries" \
86
- --reviewer "$GITHUB_ACTOR" \
105
--body "$(cat <<'EOF'
106
## Summary
107
Automated documentation updates triggered by new changelog entries merged to next.
108
109
Generated by Codex via GitHub Actions.
110
EOF
93
- )"
111
+ )")
112
+
113
+ echo "$PR_URL"
114
+ echo "pull-request-number=$(basename "$PR_URL")" >> "$GITHUB_OUTPUT"
115
+
116
+ - name: Request review from pusher
117
+ if: steps.create-pr.outputs.pull-request-number
118
+ continue-on-error: true
119
+ env:
120
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
121
+ PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
122
+ AUTHOR: ${{ github.actor }}
123
+ run: gh pr edit "$PR_NUMBER" --add-reviewer "$AUTHOR"