Skip to content

infra: switch sync-motoko to pr-automation-bot-public GitHub App#197

Merged
marc0olo merged 3 commits intomainfrom
infra/pr-automation-bot-motoko-sync
May 5, 2026
Merged

infra: switch sync-motoko to pr-automation-bot-public GitHub App#197
marc0olo merged 3 commits intomainfrom
infra/pr-automation-bot-motoko-sync

Conversation

@marc0olo
Copy link
Copy Markdown
Member

@marc0olo marc0olo commented May 5, 2026

Summary

Switches the Motoko release check workflow from using GITHUB_TOKEN with elevated permissions to the pr-automation-bot-public GitHub App, as required now that the repo is public.

Changes to .github/workflows/sync-motoko.yml:

  • Remove job-level permissions: contents: write / pull-requests: write — no longer needed when using the app token
  • Add actions/create-github-app-token step (using vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID and secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY) immediately after checkout
  • Configure git remote URL with the app token before git push, so branch creation is authenticated via the bot
  • Replace both secrets.GITHUB_TOKEN usages with steps.app-token.outputs.token (gh release view and gh pr create)

Closes #196

Next steps after merge

Trigger the Motoko release check workflow manually via workflow_dispatch to verify the bot creates the PR correctly for the pending Motoko v1.7.0 sync.

Sync recommendation

hand-written

Replace GITHUB_TOKEN (with elevated permissions) with the
pr-automation-bot-public app token for all authenticated operations:
- Add create-github-app-token step (app-id + private-key from org vars/secrets)
- Remove job-level contents: write + pull-requests: write permissions
- Configure git remote URL with app token before git push
- Use app token for gh release view and gh pr create

Closes #196
@marc0olo marc0olo requested a review from a team as a code owner May 5, 2026 09:16
The git push uses implicit checkout credentials (dfinity org defaults
GITHUB_TOKEN to read-write for contents). Only gh pr create needs the
explicit app token via GH_TOKEN. Matches the pattern in
dfinity/icskills sync-upstream.yml.
Copy link
Copy Markdown

@ggreif ggreif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks complicated. I have recently applied a cleanups to motoko's mechanism, you should compare. It uses client_id instead of the (deprecated) app_id.

….1.1

app-id is deprecated in actions/create-github-app-token in favour of
client-id. Update the input name and bump the pin to v3.1.1
(1b10c78c), which is the version that formalised this change.
@marc0olo
Copy link
Copy Markdown
Member Author

marc0olo commented May 5, 2026

Feedback addressed:

  • Switched from deprecated app-id to client-id (using vars.PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID)
  • Bumped actions/create-github-app-token pin to v3.1.1 (1b10c78c)

Note: this assumes PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID exists as an org variable alongside the existing PR_AUTOMATION_BOT_PUBLIC_APP_ID. Bas will need to confirm/provision it if not.

@marc0olo
Copy link
Copy Markdown
Member Author

marc0olo commented May 5, 2026

needs confirmation of @basvandijk that PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID exists or will be created. otherwise we should switch back to app-id for now and change later.

@basvandijk
Copy link
Copy Markdown

I just created PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID.

@marc0olo marc0olo merged commit 2864832 into main May 5, 2026
6 checks passed
@marc0olo marc0olo deleted the infra/pr-automation-bot-motoko-sync branch May 5, 2026 11:07
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.

infra: switch sync-motoko workflow to pr-automation-bot-public GitHub App

4 participants