Skip to content

Commit ea166e3

Browse files
authored
Do not run PR/issue-creating workflows in forks (#4357)
Avoid spamming forks with spurious pull requests that will only ever be merged in the primary repository. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent e591a89 commit ea166e3

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.github/workflows/cargo-update.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ permissions:
1515

1616
jobs:
1717
create-cargo-update-pr:
18+
# This workflow is restricted to the main repository (model-checking/kani) to prevent
19+
# unnecessary PRs being created in forks. The cargo update action should only run in
20+
# the main repository context.
21+
if: github.repository == 'model-checking/kani'
1822
runs-on: ubuntu-22.04
1923
steps:
2024
- name: Checkout Kani

.github/workflows/cbmc-update.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ permissions:
1515
pull-requests: write
1616

1717
jobs:
18-
create-cargo-update-pr:
18+
create-cbmc-update-pr:
19+
# This workflow is restricted to the main repository (model-checking/kani) to prevent
20+
# unnecessary PRs being created in forks. The CBMC update action should only run in
21+
# the main repository context.
22+
if: github.repository == 'model-checking/kani'
1923
runs-on: ubuntu-22.04
2024
steps:
2125
- name: Checkout Kani
@@ -75,7 +79,7 @@ jobs:
7579
Upgrade CBMC to its latest release.
7680
7781
- name: Create Issue
78-
if: ${{ env.next_step == 'create_issue' && github.repository_owner == 'model-checking' }}
82+
if: ${{ env.next_step == 'create_issue' }}
7983
uses: dacbd/create-issue-action@main
8084
with:
8185
token: ${{ github.token }}

.github/workflows/toolchain-upgrade.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ permissions:
1616

1717
jobs:
1818
create-toolchain-pr:
19+
# This workflow is restricted to the main repository (model-checking/kani) to prevent
20+
# unnecessary PRs being created in forks. The toolchain upgrade action should only run in
21+
# the main repository context.
22+
if: github.repository == 'model-checking/kani'
1923
runs-on: ubuntu-22.04
2024
steps:
2125
- name: Checkout Kani
@@ -68,7 +72,7 @@ jobs:
6872
})
6973
7074
- name: Create Issue
71-
if: ${{ env.next_step == 'create_issue' && github.repository_owner == 'model-checking' }}
75+
if: ${{ env.next_step == 'create_issue' }}
7276
uses: dacbd/create-issue-action@main
7377
with:
7478
token: ${{ github.token }}

0 commit comments

Comments
 (0)