fix: Restrict scheduled workflows to upstream repository#6948
fix: Restrict scheduled workflows to upstream repository#6948CommanderStorm merged 2 commits intomasterfrom
Conversation
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Restricts scheduled GitHub Actions workflows to only run on the upstream louislam/uptime-kuma repository to prevent forks from executing jobs that rely on upstream-only secrets/operations (and generating failure notifications).
Changes:
- Add upstream-only job conditions to
release-nightlyandstale-botworkflows. - Restrict CodeQL and zizmor jobs to run on forks only for non-scheduled events (push/PR), while keeping scheduled scans upstream-only.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/stale-bot.yml | Adds a job-level repository guard to prevent stale-bot scheduled runs on forks. |
| .github/workflows/release-nightly.yml | Adds a job-level repository guard to prevent nightly release scheduled runs on forks. |
| .github/workflows/codeql-analysis.yml | Adds an if condition to keep scheduled CodeQL/zizmor runs upstream-only while allowing push/PR runs on forks. |
| # Only run on the original repository, not on forks | ||
| if: github.repository == 'louislam/uptime-kuma' | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
This job-level condition will also skip the job for workflow_dispatch runs on forks, so manual dispatch is not actually available there. If manual dispatch should still work on forks (as described in the PR), adjust the condition to only block schedule runs (e.g., allow non-schedule events regardless of repo), or update the PR description accordingly.
| # Only run on the original repository, not on forks | ||
| if: github.repository == 'louislam/uptime-kuma' | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
This job-level condition will also skip the job for workflow_dispatch runs on forks, so manual dispatch is not actually available there. If manual dispatch should still work on forks (as described in the PR), adjust the condition to only block schedule runs (e.g., allow non-schedule events regardless of repo), or update the PR description accordingly.
Forked repositories receive failure notifications from scheduled workflows that require upstream secrets or manage upstream-specific operations.
Changes
if: github.repository == 'louislam/uptime-kuma'to prevent scheduled Docker builds on forksif: github.repository == 'louislam/uptime-kuma'to prevent stale issue management on forksif: github.event_name != 'schedule' || github.repository == 'louislam/uptime-kuma'to restrict scheduled runs while preserving push/PR security scans on forksManual workflow dispatch remains available on forks.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.