Skip to content

Commit 64a141d

Browse files
authored
trigger previews from bazel repo PRs (#125)
1 parent 1e41831 commit 64a141d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Preview Bazel docs PRs
2+
on:
3+
# Since PRs to Bazel repo may come from a fork, and those cannot see GHA Secrets,
4+
# we fall back to polling the Bazel repo for new PRs.
5+
schedule:
6+
# Every 5 minutes
7+
- cron: '*/5 * * * *'
8+
# Also allow manual triggering in the GH UI.
9+
# Press the green button on
10+
# https://github.com/bazel-contrib/bazel-docs/actions/workflows/preview-bazel-docs-pr.yml
11+
workflow_dispatch:
12+
13+
jobs:
14+
trigger:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
- uses: actions/github-script@v8
19+
with:
20+
script: |
21+
const prs = await github.rest.pulls.list({
22+
owner: 'bazelbuild',
23+
repo: 'bazel',
24+
since: new Date(Date.now() - 20 * 60 * 1000).toISOString(),
25+
});
26+
27+
28+
core.setOutput("pull_requests", JSON.stringify(prs.map(pr => ({
29+
number: pr.number,
30+
head_sha: pr.head.sha,
31+
}))));
32+
# TODO: run another step for each output.
33+
# it just calls the gh command to make a new branch on our repo that points the upstream git submodule to the PR's HEAD commit
34+
# and then triggers the run-codegen workflow on that new branch to generate the docs.

.github/workflows/trigger-from-bazel-repo.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: Update docs from Bazel repo main branch
12
on:
23
repository_dispatch:
34
types: [on-bazel-trigger]

0 commit comments

Comments
 (0)