Skip to content

Commit

Permalink
ci: Skip CI workflows on forks where permissions would cause workflow…
Browse files Browse the repository at this point in the history
… to fail.
  • Loading branch information
AaronFriel committed Nov 15, 2022
1 parent 972e1e8 commit a3684a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# The jobs in this workflow are only run on branches. The `on-community-pr.yml` job provides
# commands for running workflows from forks.

jobs:
changelog-comment:
name: changelog preview
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
permissions:
contents: read
pull-requests: write
Expand All @@ -28,6 +32,7 @@ jobs:

info:
name: info
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: ./.github/workflows/ci-info.yml
permissions:
contents: read
Expand All @@ -38,6 +43,7 @@ jobs:

ci:
name: CI
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
needs: [info]
uses: ./.github/workflows/ci.yml
permissions:
Expand Down Expand Up @@ -65,7 +71,11 @@ jobs:

prepare-release:
name: prepare
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci/test') }}
if: |
${{
github.event.pull_request.head.repo.full_name == github.repository
&& contains(github.event.pull_request.labels.*.name, 'ci/test')
}}
needs: [info, ci]
uses: ./.github/workflows/ci-prepare-release.yml
permissions:
Expand Down

0 comments on commit a3684a0

Please sign in to comment.