Skip to content

Commit cb6dddd

Browse files
ci: add repository guards to workflow files (#364)
* ci: 每30分钟自动同步上游仓库 * ci: add repository guards to workflow files - python-publish.yml: only run on OpenWSGR/AutoWSGR (upstream) - lunar.yml: only run on OpenWSGR/AutoWSGR (upstream) - sync-upstream.yml: re-add with fork-only guard (skip on upstream) This prevents publish from running on forks (missing PYPI_API_TOKEN) and keeps the sync workflow from running on the upstream repo. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8106a8e commit cb6dddd

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/lunar.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
jobs:
1212
test:
13+
if: github.repository == 'OpenWSGR/AutoWSGR'
1314
runs-on: ubuntu-latest
1415
steps:
1516
- uses: 0xWelt/Lunar@main

.github/workflows/python-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ permissions:
1919

2020
jobs:
2121
deploy:
22+
if: github.repository == 'OpenWSGR/AutoWSGR'
2223
runs-on: ubuntu-latest
2324
steps:
2425
- uses: actions/checkout@v6
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Sync upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 */6 * * *' # 每 6 小时检测上游新提交
6+
workflow_dispatch: # 也可手动触发
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
sync:
13+
if: github.repository != 'OpenWSGR/AutoWSGR'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Sync fork with upstream
17+
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: gh repo sync ${{ github.repository }} --force

0 commit comments

Comments
 (0)