Skip to content

ci(rebase-stack): use STACK_REBASE_TOKEN so rebased pushes trigger CI#166

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/fix-rebase-stack
May 29, 2026
Merged

ci(rebase-stack): use STACK_REBASE_TOKEN so rebased pushes trigger CI#166
behinddwalls merged 1 commit into
mainfrom
preetam/fix-rebase-stack

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

@behinddwalls behinddwalls commented May 29, 2026

Summary

.github/workflows/rebase-stack.yml was authenticating with the default GITHUB_TOKEN for both actions/checkout (which configures git credentials for the push) and the gh CLI. Pushes made with GITHUB_TOKEN are intentionally ignored by GitHub's workflow trigger (anti-recursion protection), so the force-pushed rebased branch never fired pull_request.synchronize and CI did not run on the rebased PR.

The repo already has a STACK_REBASE_TOKEN secret holding a personal access token but it was not referenced anywhere.

Changes

  • actions/checkout@v4 now passes token: ${{ secrets.STACK_REBASE_TOKEN }} so git push --force-with-lease is attributed to a user.
  • GH_TOKEN is set to the same secret so gh pr edit / gh pr comment are also user-attributed.
  • Removed the gh api .../check-suites POST workaround. It was a band-aid for the GITHUB_TOKEN limitation and would now create a duplicate empty check suite alongside the real pull_request.synchronize run.

Test Plan

  • make fmt and make lint clean.
  • Workflow change is exercised on PR merge; will be validated when the next stacked PR is merged and CI fires on the rebased child PR.

Issues

## Summary

`.github/workflows/rebase-stack.yml` was authenticating with the default `GITHUB_TOKEN` for both `actions/checkout` (which configures git credentials for the push) and the `gh` CLI. Pushes made with `GITHUB_TOKEN` are intentionally ignored by GitHub's workflow trigger (anti-recursion protection), so the force-pushed rebased branch never fired `pull_request.synchronize` and CI did not run on the rebased PR.

The repo already has a `STACK_REBASE_TOKEN` secret holding a personal access token but it was not referenced anywhere.

### Changes

- `actions/checkout@v4` now passes `token: ${{ secrets.STACK_REBASE_TOKEN }}` so `git push --force-with-lease` is attributed to a user.
- `GH_TOKEN` is set to the same secret so `gh pr edit` / `gh pr comment` are also user-attributed.
- Removed the `gh api .../check-suites` POST workaround. It was a band-aid for the `GITHUB_TOKEN` limitation and would now create a duplicate empty check suite alongside the real `pull_request.synchronize` run.

## Test Plan

- ✅ `make fmt` and `make lint` clean.
- Workflow change is exercised on PR merge; will be validated when the next stacked PR is merged and CI fires on the rebased child PR.

## Issues
@behinddwalls behinddwalls force-pushed the preetam/fix-rebase-stack branch from ab9e648 to e345a70 Compare May 29, 2026 16:37
@behinddwalls behinddwalls marked this pull request as ready for review May 29, 2026 16:38
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners May 29, 2026 16:38
Copy link
Copy Markdown
Contributor

@albertywu albertywu left a comment

Choose a reason for hiding this comment

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

nice, let's try it

@behinddwalls behinddwalls enabled auto-merge May 29, 2026 17:27
@behinddwalls behinddwalls disabled auto-merge May 29, 2026 17:27
@behinddwalls behinddwalls merged commit 531f198 into main May 29, 2026
13 checks passed
@behinddwalls behinddwalls deleted the preetam/fix-rebase-stack branch May 29, 2026 17:27
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