Skip to content

Commit e66032e

Browse files
committed
ci: prefer TechEngineBot token for TechAPI PRs
1 parent 393dcf2 commit e66032e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/weekly-ingest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
LIMIT: ${{ inputs.limit || '50' }}
3333
INCLUDE_DRAFTS: ${{ inputs.include_drafts || 'false' }}
3434
TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
35+
TECHAPI_WRITE_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN }}
3536
steps:
3637
- uses: actions/checkout@v4
3738

@@ -41,7 +42,7 @@ jobs:
4142
with:
4243
repository: GetTechAPI/TechAPI
4344
path: TechAPI
44-
token: ${{ secrets.TECHAPI_TOKEN || secrets.GITHUB_TOKEN }}
45+
token: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN || secrets.GITHUB_TOKEN }}
4546

4647
- uses: actions/setup-python@v5
4748
with:
@@ -112,7 +113,7 @@ jobs:
112113
- name: Open PR against TechAPI
113114
if: steps.changes.outputs.has_changes == 'true'
114115
env:
115-
GH_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
116+
GH_TOKEN: ${{ env.TECHAPI_WRITE_TOKEN }}
116117
run: |
117118
set -euo pipefail
118119
if [ -z "${GH_TOKEN:-}" ]; then

.github/workflows/weekly-refresh.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ name: weekly-refresh
1111
# Token model: TechAPI is public, so the checkout uses the default GITHUB_TOKEN
1212
# (read-only) as a fallback — that lets the collect→validate→dump path run on
1313
# every push even when no PAT is configured. Only the cross-repo PR needs write
14-
# access, so just that step is guarded by `secrets.TECHAPI_TOKEN`. Add the PAT
15-
# (TechAPI Contents:write + Pull requests:write) as TECHAPI_TOKEN to enable PRs.
14+
# access, so just that step is guarded by a PAT. Prefer TECHENGINEBOT_TOKEN
15+
# so PRs are authored by TechEngineBot; fall back to TECHAPI_TOKEN.
1616
on:
1717
schedule:
1818
- cron: "0 6 * * 1" # Mondays 06:00 UTC (live scrape: weekly to respect upstream ToS/rate limits)
@@ -36,6 +36,7 @@ jobs:
3636
env:
3737
SLEEP: ${{ inputs.sleep || '1.0' }}
3838
TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
39+
TECHAPI_WRITE_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN }}
3940
# Validate/seed/dump all read the data tree from this env var.
4041
TECHAPI_DATA_DIR: ${{ github.workspace }}/techapi/data
4142
steps:
@@ -49,7 +50,7 @@ jobs:
4950
with:
5051
repository: GetTechAPI/TechAPI
5152
path: techapi
52-
token: ${{ secrets.TECHAPI_TOKEN || secrets.GITHUB_TOKEN }}
53+
token: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN || secrets.GITHUB_TOKEN }}
5354

5455
- uses: actions/setup-python@v5
5556
with:
@@ -137,7 +138,7 @@ jobs:
137138

138139
# Fallback when no PAT: keep the regenerated dump so the work isn't lost.
139140
- name: Upload dump artifact (no-token fallback)
140-
if: env.TECHAPI_TOKEN == ''
141+
if: env.TECHAPI_WRITE_TOKEN == ''
141142
uses: actions/upload-artifact@v4
142143
with:
143144
name: dump-${{ steps.meta.outputs.date }}
@@ -148,11 +149,11 @@ jobs:
148149

149150
# --- 4. Dated branch + auto PR against TechAPI (only with a PAT) ---
150151
- name: Create refresh PR
151-
if: env.TECHAPI_TOKEN != ''
152+
if: env.TECHAPI_WRITE_TOKEN != ''
152153
uses: peter-evans/create-pull-request@v6
153154
with:
154155
path: ./techapi
155-
token: ${{ secrets.TECHAPI_TOKEN }}
156+
token: ${{ env.TECHAPI_WRITE_TOKEN }}
156157
branch: refresh/${{ steps.meta.outputs.date }}
157158
base: main
158159
add-paths: |

0 commit comments

Comments
 (0)