Skip to content

Commit e9c2939

Browse files
authored
Enhance sync-upstream PR workflow for fork safety
Updated workflow to be fork-safe and improved PR message.
1 parent 5514fea commit e9c2939

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

.github/workflows/sync-upstream-pr.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Sync Upstream (PR-based)
1+
name: Sync Upstream (PR-based, fork-safe)
22

33
on:
44
schedule:
@@ -29,10 +29,22 @@ jobs:
2929
git remote add upstream https://github.com/github/docs.git || true
3030
git fetch upstream
3131
32-
- name: Create sync branch
32+
- name: Create sync branch from upstream
3333
run: |
3434
git checkout -B upstream-sync upstream/main
3535
36+
# 🚫 HARD BLOCK: never allow workflow files from upstream
37+
- name: Remove upstream workflows (fork-safe)
38+
run: |
39+
rm -rf .github/workflows
40+
mkdir -p .github/workflows
41+
echo "# Fork-safe workflows only" > .github/workflows/.keep
42+
43+
- name: Commit sanitized upstream changes
44+
run: |
45+
git add .
46+
git commit -m "Sync upstream (workflows stripped)" || echo "No changes"
47+
3648
- name: Push sync branch
3749
run: |
3850
git push origin upstream-sync --force
@@ -41,11 +53,15 @@ jobs:
4153
uses: peter-evans/create-pull-request@v6
4254
with:
4355
branch: upstream-sync
56+
base: main
4457
title: "⬆️ Sync with upstream (github/docs)"
4558
body: |
46-
Automated PR to sync this fork with the latest upstream changes.
47-
- Runs every 5 minutes
48-
- Fork-safe
49-
- No auto-merge
50-
base: main
59+
Automated upstream sync PR.
60+
61+
✅ Fork-safe
62+
🚫 Upstream workflows stripped
63+
🔁 Runs every 5 minutes
64+
labels: |
65+
upstream-sync
66+
automated
5167
delete-branch: false

0 commit comments

Comments
 (0)