Skip to content

ci: add repository guards to workflow files#364

Merged
yltx merged 11 commits intoOpenWSGR:mainfrom
yltx:ci/workflow-repo-guards
Mar 11, 2026
Merged

ci: add repository guards to workflow files#364
yltx merged 11 commits intoOpenWSGR:mainfrom
yltx:ci/workflow-repo-guards

Conversation

@yltx
Copy link
Copy Markdown
Contributor

@yltx yltx commented Mar 11, 2026

问题

Fork 同步 upstream 后会获得 publish workflow,导致 fork 上也尝试发布 PyPI(因缺少 PYPI_API_TOKEN 而失败)。反过来,fork 专用的 sync-upstream workflow 之前被上游删除后也丢失了。

方案

if: github.repository == / != 条件守卫,让所有 workflow 文件在两个仓库中共存,但只在正确的仓库上执行:

Workflow 运行位置 守卫条件
python-publish.yml 主仓库 github.repository == 'OpenWSGR/AutoWSGR'
lunar.yml 主仓库 github.repository == 'OpenWSGR/AutoWSGR'
sync-upstream.yml Fork github.repository != 'OpenWSGR/AutoWSGR'

变更

  • python-publish.yml: 添加 if 限制仅在上游执行
  • lunar.yml: 添加 if 限制仅在上游执行
  • sync-upstream.yml: 重新添加,带有 fork-only 守卫条件,每 6 小时同步一次

@yltx yltx merged commit cb6dddd into OpenWSGR:main Mar 11, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant