Skip to content

Commit 148c2fc

Browse files
committed
ci: restrict specific workflows to the upstream repository
Many GitHub Actions workflows currently trigger on user forks, leading to unnecessary CI resource consumption, unwanted bot behavior, and inevitable failures. This commit restricts these specific workflows to only run on the primary `containers/podman` repository. The restricted workflows fall into two main categories: 1. Require Custom Upstream Secrets: Workflows like `release`, `mac-pkg`, `cherry-pick`, and `dev-bump` rely on secrets (e.g., Apple/Azure certs, PODMANBOT_TOKEN, ACTION_MAIL_*) that are unavailable in forks. 2. Manage Upstream Tracker State: Workflows like `assign`, `stale`, and `labeler` are intended strictly for managing the primary project's issues and PRs. Running them on personal forks creates unwanted noise. Additionally, refactored several complex `if` conditions using YAML multi-line strings (`|`) to maintain and improve readability. Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
1 parent bd7e8bb commit 148c2fc

13 files changed

Lines changed: 26 additions & 6 deletions

.github/workflows/assign.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ on:
77
jobs:
88
assign:
99
# Only run on issue comments (not PR comments)
10-
if: "!github.event.issue.pull_request && contains(github.event.comment.body, '/assign')"
10+
if: |
11+
!github.event.issue.pull_request &&
12+
contains(github.event.comment.body, '/assign') &&
13+
github.repository == 'containers/podman'
1114
runs-on: ubuntu-latest
1215
permissions:
1316
issues: write

.github/workflows/check_cirrus_cron.yml

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

4242
jobs:
4343
cron_failures:
44+
if: github.repository == 'containers/podman'
4445
runs-on: ubuntu-latest
4546
steps:
4647
# This is where the scripts live

.github/workflows/cherry-pick.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
if: |
1212
github.event_name == 'issue_comment' &&
1313
github.event.issue.pull_request &&
14-
contains(github.event.comment.body, '/cherry-pick ')
14+
contains(github.event.comment.body, '/cherry-pick ') &&
15+
github.repository == 'containers/podman'
1516
runs-on: ubuntu-latest
1617
permissions:
1718
contents: write
@@ -194,7 +195,8 @@ jobs:
194195
cherry-pick-on-merge:
195196
if: |
196197
github.event_name == 'pull_request' &&
197-
github.event.pull_request.merged == true
198+
github.event.pull_request.merged == true &&
199+
github.repository == 'containers/podman'
198200
runs-on: ubuntu-latest
199201
permissions:
200202
contents: write

.github/workflows/dev-bump.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions: {}
88

99
jobs:
1010
bump:
11+
if: github.repository == 'containers/podman'
1112
name: Bump to -dev
1213
runs-on: ubuntu-latest
1314
permissions:

.github/workflows/first_contrib_cert_generator.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ jobs:
2222
screenshot_and_comment:
2323
# This job runs if the PR was merged or if it's a manual trigger.
2424
# The logic for first-time contributors is handled in a dedicated step below.
25-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
25+
if: |
26+
(
27+
github.event_name == 'workflow_dispatch' ||
28+
github.event.pull_request.merged == true
29+
) &&
30+
github.repository == 'containers/podman'
2631
runs-on: ubuntu-latest
2732
permissions:
2833
contents: read # Write access for certificate storage

.github/workflows/issue-labeler.yml

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

99
jobs:
1010
triage:
11+
if: github.repository == 'containers/podman'
1112
permissions:
1213
contents: read # for github/issue-labeler to get repo contents
1314
issues: write # for github/issue-labeler to create or remove labels

.github/workflows/issue_pr_lock.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ env:
4545

4646
jobs:
4747
manage_locking:
48+
if: github.repository == 'containers/podman'
4849
runs-on: ubuntu-latest
4950
permissions:
5051
issues: write

.github/workflows/labeler.yml

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

88
jobs:
99
triage:
10+
if: github.repository == 'containers/podman'
1011
permissions:
1112
contents: read
1213
pull-requests: write

.github/workflows/machine-os-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ concurrency:
1414

1515
jobs:
1616
podman-image-build-pr:
17+
if: github.repository == 'containers/podman'
1718
name: Open PR on podman-machine-os
1819
runs-on: ubuntu-latest
1920
permissions:

.github/workflows/needs-info-labeler.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ permissions: {}
88

99
jobs:
1010
add-comment:
11-
if: github.event.label.name == 'needs-info'
11+
if: |
12+
github.event.label.name == 'needs-info' &&
13+
github.repository == 'containers/podman'
1214
runs-on: ubuntu-latest
1315
permissions:
1416
issues: write

0 commit comments

Comments
 (0)