Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

ci(docs): open docs PRs with the release-bot app token

jkomyno1e55f0a52ede
diff --git a/.github/workflows/docs.changelog-to-docs.yml b/.github/workflows/docs.changelog-to-docs.yml
index a4f8044fe..f95bc31bf 100644
--- a/.github/workflows/docs.changelog-to-docs.yml
+++ b/.github/workflows/docs.changelog-to-docs.yml
@@ -17,11 +17,25 @@ jobs:
permissions:
contents: write
pull-requests: write
+ id-token: write
steps:
+ # `GITHUB_TOKEN` cannot open pull requests here: the repository has
+ # "Allow GitHub Actions to create and approve pull requests" disabled, so
+ # `createPullRequest` is rejected no matter what `pull-requests` grants.
+ # Every other PR-opening workflow in this repo mints a release-bot App
+ # token for exactly this reason.
+ - name: Generate GitHub App token
+ id: app-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
+ private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
+
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
+ token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Detect new changelog files
@@ -62,9 +76,10 @@ jobs:
5. If no docs changes are needed, make no file changes and explain why
- name: Create PR if docs changed
+ id: create-pr
if: steps.detect.outputs.found == 'true'
env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "No documentation changes needed"
@@ -79,15 +94,30 @@ jobs:
git commit -m "docs: update documentation for new changelog entries"
git push -u origin "$BRANCH"
- gh pr create \
+ # Requesting the reviewer is deliberately NOT part of this call: an
+ # unassignable actor (bot account, non-collaborator) would fail the
+ # whole command after the branch is already pushed, leaving an orphan
+ # branch and no PR. It runs as a separate best-effort step below.
+ PR_URL=$(gh pr create \
--base next \
--head "$BRANCH" \
--title "docs: update documentation for new changelog entries" \
- --reviewer "$GITHUB_ACTOR" \
--body "$(cat <<'EOF'
## Summary
Automated documentation updates triggered by new changelog entries merged to next.
Generated by Codex via GitHub Actions.
EOF
- )"
+ )")
+
+ echo "$PR_URL"
+ echo "pull-request-number=$(basename "$PR_URL")" >> "$GITHUB_OUTPUT"
+
+ - name: Request review from pusher
+ if: steps.create-pr.outputs.pull-request-number
+ continue-on-error: true
+ env:
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
+ PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
+ AUTHOR: ${{ github.actor }}
+ run: gh pr edit "$PR_NUMBER" --add-reviewer "$AUTHOR"
diff --git a/.github/workflows/docs.sync-connect-clients.yml b/.github/workflows/docs.sync-connect-clients.yml
index 2ed6b5123..9718ca67f 100644
--- a/.github/workflows/docs.sync-connect-clients.yml
+++ b/.github/workflows/docs.sync-connect-clients.yml
@@ -18,9 +18,19 @@ jobs:
id-token: write
steps:
+ # See docs.changelog-to-docs.yml: `GITHUB_TOKEN` cannot open pull requests
+ # in this repository, so the PR step below needs a release-bot App token.
+ - name: Generate GitHub App token
+ id: app-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
+ private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
+
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
+ token: ${{ steps.app-token.outputs.token }}
ref: next
fetch-depth: 1
@@ -71,6 +81,7 @@ jobs:
id: create-pr
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
+ token: ${{ steps.app-token.outputs.token }}
commit-message: 'docs: sync Connect clients from dashboard'
title: 'docs: sync Connect clients from dashboard'
body: |
@@ -95,7 +106,7 @@ jobs:
- name: Request review from trigger actor
if: steps.create-pr.outputs.pull-request-number
env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
AUTHOR: ${{ github.actor }}
run: gh pr edit "$PR_NUMBER" --add-reviewer "$AUTHOR"