Repository navigation
84 lines (74 loc) · 2.86 KB
/
Copy pathsync-pack-options.yaml
File metadata and controls
84 lines (74 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Sync Pack Options
# Keeps the base-pack dropdown in the "Request Personal Pack" issue template
# aligned with what's on disk under `content/`. Runs whenever a push to main
# changes anything under `content/` (or the sync script / workflow itself),
# regenerates the marker-bracketed pack block in the template, and commits
# the result back if it changed.
#
# Pushes from the default GITHUB_TOKEN do not recursively trigger workflows,
# so this can't loop on its own commit. Sister to sync-collective-slugs.yaml
# and sync-team-members.yaml.
on:
push:
branches: [main]
paths:
- 'content/**'
- 'scripts/sync-pack-options.ts'
- '.github/workflows/sync-pack-options.yaml'
permissions:
contents: write
pull-requests: write
concurrency:
group: sync-pack-options
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# pin: actions/checkout@v4.3.1
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up PNPM
# pin: pnpm/action-setup@v4.4.0
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
with:
version: 10.11.0
- name: Use Node.js 22
# pin: actions/setup-node@v4.4.0
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Regenerate base-pack dropdown
run: pnpm sync-pack-options
- name: Commit on chore branch and open PR if changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
FILE=.github/ISSUE_TEMPLATE/personal-request.yml
BRANCH=chore/sync-pack-options
if git diff --quiet -- "$FILE"; then
echo "no changes — base-pack dropdown already up to date"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add "$FILE"
git commit -m "chore: sync base-pack dropdown"
git push --force --set-upstream origin "$BRANCH"
EXISTING=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty')
if [ -z "$EXISTING" ]; then
gh pr create \
--base main \
--head "$BRANCH" \
--title "chore: sync base-pack dropdown" \
--body "Auto-generated by sync-pack-options. Regenerates the base-pack dropdown in personal-request.yml from the directories under content/."
else
echo "PR #$EXISTING already open for $BRANCH — force-pushed update"
fi