Skip to content

Commit c99b8bb

Browse files
committed
ci(github): add workflow to auto-sync tags to website
- Triggers when scripts-metadata.yaml changes - Checks out both msp-scripts and website repos - Runs sync script to update frontmatter - Commits and pushes changes to website develop branch - Requires WEBSITE_PAT secret for cross-repo access
1 parent e358314 commit c99b8bb

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/sync-tags.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Sync Script Tags to Website
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
paths:
7+
- 'scripts-metadata.yaml'
8+
workflow_dispatch: # Allow manual trigger
9+
10+
jobs:
11+
sync-tags:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout msp-scripts repo
16+
uses: actions/checkout@v4
17+
with:
18+
path: msp-scripts
19+
20+
- name: Checkout website repo
21+
uses: actions/checkout@v4
22+
with:
23+
repository: Glyph-SH/website
24+
token: ${{ secrets.WEBSITE_PAT }}
25+
path: website
26+
ref: develop # Always update develop branch
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.x'
32+
33+
- name: Install dependencies
34+
run: pip install PyYAML
35+
36+
- name: Run sync script
37+
run: |
38+
cd msp-scripts
39+
python3 sync-tags-to-website.py ../website
40+
41+
- name: Check for changes
42+
id: check_changes
43+
run: |
44+
cd website
45+
if [[ -n $(git status --porcelain) ]]; then
46+
echo "has_changes=true" >> $GITHUB_OUTPUT
47+
else
48+
echo "has_changes=false" >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Commit and push changes
52+
if: steps.check_changes.outputs.has_changes == 'true'
53+
run: |
54+
cd website
55+
git config user.name "GitHub Actions Bot"
56+
git config user.email "actions@github.com"
57+
git add content/scripts/
58+
git commit -m "chore(scripts): auto-sync tags from msp-scripts metadata
59+
60+
Synced by GitHub Actions from msp-scripts@${{ github.sha }}"
61+
git push origin develop
62+
63+
- name: Summary
64+
run: |
65+
if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then
66+
echo "✅ Tags synced successfully to website repo"
67+
else
68+
echo "⏭️ No changes detected - tags already in sync"
69+
fi

0 commit comments

Comments
 (0)