Skip to content

ci(weekly): open the downloads pull request with a personal access token - #461

Merged
joe-bell merged 5 commits into
mainfrom
claude/project-thread-mofsak
Oct 16, 2026
Merged

joe-bell merged 5 commits into
mainfrom
claude/project-thread-mofsak

Conversation

@joe-bell

@joe-bell joe-bell commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Requested by Joe · project thread

Description

Before: the weekly npm downloads pull request (for example #459) shows "2 workflows awaiting approval", and every required check sits at "Waiting for status to be reported" until a maintainer approves the ci and cloudflare runs by hand.

After: the weekly pull request's checks start on their own, the same as any other pull request.

weekly / npm-downloads pushed the snapshot and opened the pull request with GITHUB_TOKEN, so github-actions[bot] triggered the pull request's pull_request workflows. GitHub records those runs as action_required (both runs on #459 show that conclusion) rather than starting them, and no repository setting lifts that.

How: the push and gh pr create now use WEEKLY_AUTOMATION_TOKEN, a fine-grained personal access token, instead of GITHUB_TOKEN. That token acts as the owner, who bypasses the default-branch ruleset, so it is kept away from untrusted code:

  • The job runs in a weekly-automation environment that only main may deploy to. A run dispatched from another branch, or a new workflow added on one, can't read the token.
  • The step unsets core.hooksPath before using the token, and it never checks out the unprotected update branch. Each run rebuilds automation/weekly-npm-downloads as origin/main plus one snapshot commit and force-pushes it with a lease. The run skips the push when the remote already matches.
  • Because the pushed commit only touches the snapshot, the token doesn't need the Workflows permission even when main has gained workflow changes. The old merge of main into the branch would have needed it.

Commits keep the github-actions[bot] author. The workflow's own GITHUB_TOKEN drops to contents: read.

Additional context

This needs repository configuration before merging, or the next weekly run fails:

  1. Create a fine-grained personal access token with access to joe-bell/cva only, and repository permissions Contents: Read and write and Pull requests: Read and write.
  2. Create an environment named weekly-automation, and set its deployment branches to the selected branch main only.
  3. Add the token to that environment as the secret WEEKLY_AUTOMATION_TOKEN, and delete any repository-level secret with the same name.

The token expires on the date chosen at creation, so it needs renewing. Pull requests the workflow opens will list the token's owner as author.

After merging, running the workflow manually from main rebuilds automation/weekly-npm-downloads with the token, which starts the checks on #459 without an approval. The workflow only runs from main on a schedule or dispatch, so this PR's CI cannot exercise it. I tested the new push logic against a local remote instead: an existing branch behind a workflow change on main, an identical re-run that skips the push, and a deleted branch.

This changes CI only, not packages/cva, so the beta What's New page is unaffected.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

🤖 Generated with Claude Code

https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN

A push or pull request made with `GITHUB_TOKEN` leaves the pull request's
`pull_request` workflows waiting for maintainer approval, so the weekly
downloads pull request never reports its required checks on its own. Mint
a GitHub App installation token for the push and the pull request instead,
and drop the workflow's own `GITHUB_TOKEN` to read-only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN
@joe-bell joe-bell self-assigned this Oct 6, 2026

joe-bell commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

cloudflare / gate failed because Cloudflare never reported a Workers Builds: cva check for faa94ba. The change to docs/README.md matches the docs/* watch path, so the gate waits for that check. Every other check on this head is green.

This is not caused by the diff. Cloudflare's build list for the cva Worker has no build for this push at all. The latest entries are main at 939eb1b and earlier branches. So the push event either never reached Workers Builds or was dropped. The fix is to start a build for claude/project-thread-mofsak from the Cloudflare dashboard (Workers → cva → Deployments → Builds), then re-run this gate. I don't have permission to start a build on the account from here.

Separately, both live Workers Builds triggers leave out examples/beta/react-with-tailwindcss/*, which .github/cloudflare/docs-watch-paths.json includes. That drift is pre-existing and unrelated to this PR.


Generated by Claude Code

@joe-bell
joe-bell marked this pull request as ready for review October 6, 2026 13:26
Replace the GitHub App token with an `AUTOMATION_TOKEN` fine-grained
personal access token, so the setup is a single repository secret. It
still keeps pushes and the pull request off `GITHUB_TOKEN`, so the
weekly pull request's checks run without approval.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN
@joe-bell joe-bell changed the title ci(weekly): open the downloads pull request as a GitHub App ci(weekly): open the downloads pull request with a personal access token Oct 6, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
cva 627b74a Commit Preview URL

Branch Preview URL
Oct 16 2026, 10:08 AM

Match the name the secret was created under in the repository settings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN
Repository owner deleted a comment from dates-yong-scepter-babble Oct 16, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 16, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T10:20:29.069030Z 01bcf2a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56bd88c7e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/weekly.yml Resolved
A repository secret is readable by any branch: a write-access user can
dispatch the workflow from a branch whose copy prints the token, and the
token acts as the owner, who bypasses the default-branch ruleset. Run the
job in the `weekly-automation` environment so the token is only released
to `main`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 627b74a855

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/weekly.yml Resolved
Comment thread docs/README.md Resolved
Merging `main` into the update branch made the token push a merge commit
that carries `main`'s workflow-file changes, which a token without the
Workflows permission cannot write. Checking that unprotected branch out
also ran whatever a collaborator pushed to it, hooks included, while the
token was exposed.

Rebuild the branch from `origin/main` plus the snapshot commit on every
run and force-push it with a lease, skip the push when the remote already
matches, and unset `core.hooksPath` before using the token.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fc28pKY9wf4DFssSzoNRN

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 01bcf2a9d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joe-bell
joe-bell enabled auto-merge (squash) October 16, 2026 10:34
@joe-bell
joe-bell disabled auto-merge October 16, 2026 10:34
@joe-bell
joe-bell merged commit e703e4b into main Oct 16, 2026
16 checks passed
@joe-bell
joe-bell deleted the claude/project-thread-mofsak branch October 16, 2026 10:34
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