From 15c81f93d2f2af5bb710d3216c66f1d843a59161 Mon Sep 17 00:00:00 2001 From: TwiN Date: Sat, 23 Sep 2023 15:02:33 -0400 Subject: [PATCH] ci: Publish only if the workflow is not running on a fork (#574) * ci: Publish only if the workflow is not running on a fork Otherwise, the workflow will attempt to publish on forks from contributors that are using the master branch --- .github/workflows/publish-latest-to-ghcr.yml | 4 ++-- .github/workflows/publish-latest.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-latest-to-ghcr.yml b/.github/workflows/publish-latest-to-ghcr.yml index 0dfaedb5..79e5efc0 100644 --- a/.github/workflows/publish-latest-to-ghcr.yml +++ b/.github/workflows/publish-latest-to-ghcr.yml @@ -5,12 +5,12 @@ on: branches: [master] types: [completed] concurrency: - group: ${{ github.workflow }} + group: ${{ github.event.workflow_run.head_repository.full_name }}::${{ github.event.workflow_run.head_branch }} - ${{ github.workflow }} cancel-in-progress: true jobs: publish-latest-to-ghcr: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ (github.event.workflow_run.conclusion == 'success') && (github.event.pull_request.head.repo.full_name == github.repository) }} permissions: contents: read packages: write diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml index 58af9647..bbe933dc 100644 --- a/.github/workflows/publish-latest.yml +++ b/.github/workflows/publish-latest.yml @@ -5,12 +5,12 @@ on: branches: [master] types: [completed] concurrency: - group: ${{ github.workflow }} + group: ${{ github.event.workflow_run.head_repository.full_name }}::${{ github.event.workflow_run.head_branch }} - ${{ github.workflow }} cancel-in-progress: true jobs: publish-latest: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ (github.event.workflow_run.conclusion == 'success') && (github.event.pull_request.head.repo.full_name == github.repository) }} timeout-minutes: 60 steps: - uses: actions/checkout@v3