Skip to content

Commit 1957738

Browse files
committed
ci: open the nightly PRs as the riseproject-dev App
Branches pushed and PRs opened with GITHUB_TOKEN raise no events, so the per-package upgrade PRs ended up with no checks at all. Mint a riseproject-dev installation token when RISEPROJECT_APP_ID is set and commit as its bot, falling back to GITHUB_TOKEN otherwise.
1 parent aa36676 commit 1957738

4 files changed

Lines changed: 52 additions & 8 deletions

File tree

‎.github/workflows/nightly.yml‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,22 @@ jobs:
2525
check_versions:
2626
runs-on: ubuntu-latest
2727
steps:
28+
# A branch pushed or a PR opened with GITHUB_TOKEN raises no events, so
29+
# the per-package PRs would sit there with no checks at all. Push and open
30+
# them as the App instead; without its credentials, or on a pull request
31+
# (where a fork or Dependabot has none), the job still runs, it just falls
32+
# back to the checkless GITHUB_TOKEN.
33+
- uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
34+
id: app-token
35+
if: ${{ vars.RISEPROJECT_APP_ID != '' && github.event_name != 'pull_request' }}
36+
with:
37+
app-id: ${{ vars.RISEPROJECT_APP_ID }}
38+
private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
39+
2840
- uses: actions/checkout@v7
2941
with:
3042
fetch-depth: 0
43+
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
3144

3245
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
3346
with:
@@ -37,7 +50,7 @@ jobs:
3750
# declared again per package, on that package's own branch, below.
3851
- name: Check versions
3952
env:
40-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
4154
SINCE: "2026-09-01"
4255
run: |
4356
uv run --with-requirements ci_scripts/requirements.txt python3 ci_scripts/check_versions.py \
@@ -49,14 +62,14 @@ jobs:
4962
- name: Open or update one PR per package
5063
if: github.event_name != 'pull_request'
5164
env:
52-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
66+
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
5367
REPORTS: ${{ runner.temp }}/reports
5468
run: |
5569
set -euo pipefail
5670
5771
base=$(git rev-parse HEAD)
58-
git config user.name "github-actions[bot]"
59-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
72+
ci_scripts/git-identity.sh
6073
6174
# Branch off main and re-declare this package alone, so the PR only
6275
# ever touches its own docs/packages/<pkg>.yaml (plus packages.txt and

‎ci_scripts/git-identity.sh‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
# SPDX-FileCopyrightText: 2026 The RISE Project
3+
# SPDX-License-Identifier: MIT
4+
5+
# Configure the identity the automation commits under: the GitHub App bot when
6+
# the workflow minted an App token (APP_SLUG set by create-github-app-token),
7+
# the Actions bot otherwise. The numeric account id in the address is what ties
8+
# a commit to that bot on GitHub, and only the API knows it.
9+
10+
set -eu
11+
12+
if [ -n "${APP_SLUG:-}" ]; then
13+
name="${APP_SLUG}[bot]"
14+
id=$(gh api "/users/${APP_SLUG}%5Bbot%5D" --jq '.id')
15+
else
16+
name="github-actions[bot]"
17+
id=41898282
18+
fi
19+
20+
git config user.name "$name"
21+
git config user.email "${id}+${name}@users.noreply.github.com"

‎ci_scripts/update_doc.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,7 @@ def pr_exists(branch):
321321

322322

323323
def configure_git_identity():
324-
git_run("config", "user.name", "github-actions[bot]")
325-
git_run(
326-
"config", "user.email", "41898282+github-actions[bot]@users.noreply.github.com"
327-
)
324+
subprocess.run([CI_SCRIPTS_DIR / "git-identity.sh"], check=True)
328325

329326

330327
def extract_pr_url(stdout):

‎docs/workflows.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ following workflows beyond those used for specific package builds:
111111
pending ones, or those matching the `version` glob of a
112112
`workflow_dispatch`).
113113

114+
### The riseproject-dev App
115+
116+
Branches pushed and pull requests opened with the default `GITHUB_TOKEN` raise
117+
no events, so nothing ever runs on them: the nightly upgrade PRs would sit
118+
there with no checks. `nightly.yml` therefore mints an installation token for
119+
the `riseproject-dev` GitHub App and commits as `riseproject-dev[bot]`. It
120+
needs the repository variable `RISEPROJECT_APP_ID` (the App's numeric App ID)
121+
and the repository secret `RISEPROJECT_APP_PRIVATE_KEY` (the App's private key,
122+
PEM included), and the App must be installed on this repository with read and
123+
write access to contents and pull requests, plus read access to issues. With
124+
the variable unset the workflow falls back to `GITHUB_TOKEN` and the
125+
`github-actions[bot]` identity, checkless as before.
126+
114127
## The RISC-V Wheels Dashboard
115128

116129
RISE makes use of the [RISC-V

0 commit comments

Comments
 (0)