From db519ab3d6fe997d42c4894a33fd6aa608bd0dcc Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 18 Nov 2023 14:08:07 +0900 Subject: [PATCH] Fix skip jobs that cannot be running on fork --- .github/workflows/actionlint.yml | 2 +- .github/workflows/metacheck.yml | 2 +- .github/workflows/pr-labeler.yml | 1 + .github/workflows/release-drafter.yml | 1 + .github/workflows/release.yml | 1 + .github/workflows/test.yml | 3 ++- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 155b091..76299f3 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -39,4 +39,4 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: failure() && github.repository_owner == 'nowsprinting' # Skip on public fork, because can not read secrets. + if: failure() && github.event.pull_request.head.repo.fork == false # Skip on public fork, because can not read secrets. diff --git a/.github/workflows/metacheck.yml b/.github/workflows/metacheck.yml index fd52c8a..9e50198 100644 --- a/.github/workflows/metacheck.yml +++ b/.github/workflows/metacheck.yml @@ -34,4 +34,4 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: failure() && github.repository_owner == 'nowsprinting' # Skip on public fork, because can not read secrets. + if: failure() && github.event.pull_request.head.repo.fork == false # Skip on public fork, because can not read secrets. diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 0ae58cb..fbcdd1c 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -9,6 +9,7 @@ on: jobs: pr-labeler: + if: github.event.pull_request.head.repo.fork == false # Skip on public fork runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 0bbceb6..87420c8 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -15,6 +15,7 @@ concurrency: jobs: release-drafter: + if: github.repository_owner == 'nowsprinting' # Skip on forked repo runs-on: ubuntu-latest permissions: contents: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a6d96b..0eb9a0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ on: jobs: check-bump-version: + if: github.repository_owner == 'nowsprinting' # Skip on forked repo runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c8e471..9ee5c76 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ concurrency: jobs: test: + if: github.event.pull_request.head.repo.fork == false # Skip on public fork, because can not read secrets. runs-on: ubuntu-latest permissions: contents: read @@ -114,10 +115,10 @@ jobs: notify: needs: test + if: github.event.pull_request.head.repo.fork == false # Skip on public fork, because can not read secrets. runs-on: ubuntu-latest permissions: actions: read - if: always() steps: - uses: Gamesight/slack-workflow-status@v1.2.0