Skip to content

Add --stack option to test a GitHub PR stack - #44

Open
christophebedard wants to merge 1 commit into
christophebedard/ci-for-pr-refactorsfrom
christophebedard/ci-for-pr-stack
Open

christophebedard wants to merge 1 commit into
christophebedard/ci-for-pr-refactorsfrom
christophebedard/ci-for-pr-stack

Conversation

@christophebedard

@christophebedard christophebedard commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Given a PR that is part of a GitHub PR stack, look up the whole stack and use the source branch of the top PR in the modified ros2.repos, since it contains the changes from all PRs of the stack. With --comment, post the comment on every open PR of the stack; this also works with --test-report.

PyGithub does not support PR stacks, so query the REST API directly: https://docs.github.com/en/rest/pulls/stacks

When using --build, ask for confirmation if the stack targets a different branch than the selected release (this check already exists for normal PRs), or if the top PR's branch is missing changes from the other PRs of the stack.

--stack cannot be combined with --pulls, --interactive, or --branch: testing a PR stack along with other PRs is not supported for now.


Example: ros2/rviz#1916 is stacked on ros2/rviz#1915 against Lyrical. Running:

$ GITHUB_TOKEN=... ros-ci-for-pr \
  --stack ros2/rviz#1915 -k rviz_ogre_vendor -t lyrical -b -c

Creates a gist using ros2/rviz#1916 (the top of the stack, which includes ros2/rviz#1915's changes) and comments on both ros2/rviz#1915 and ros2/rviz#1916 with the CI jobs info:

I used Claude Opus 5.5 to implement this.

Given a PR that is part of a GitHub PR stack, look up the whole stack
and use the source branch of the top PR in the modified `ros2.repos`,
since it contains the changes from all PRs of the stack. With
`--comment`, post the comment on every open PR of the stack; this also
works with `--test-report`.

PyGithub does not support PR stacks, so query the REST API directly:
https://docs.github.com/en/rest/pulls/stacks

When using `--build`, ask for confirmation if the stack targets a
different branch than the selected release (this check already exists
for normal PRs), or if the top PR's branch is missing changes from the
other PRs of the stack.

`--stack` cannot be combined with `--pulls`, `--interactive`, or
`--branch`: testing a PR stack along with other PRs is not supported
for now.

---

Example: ros2/rviz#1916 is stacked on ros2/rviz#1915 against Lyrical.
Running:

```
$ GITHUB_TOKEN=... ros-ci-for-pr \
  -s ros2/rviz#1915 -k rviz_ogre_vendor -t lyrical -b -c
```

Creates a gist using ros2/rviz#1916 (the top of the stack, which
includes ros2/rviz#1915's changes) and comments on both ros2/rviz#1915
and ros2/rviz#1916 with the CI jobs info:

* ros2/rviz#1915 (comment)
* ros2/rviz#1916 (comment)

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
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.

3 participants