diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 9afc0e83..fcdb6ea9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -72,7 +72,7 @@ jobs: name: Release needs: [init, fast_checks, full_checks, min_version, build, sanitize] if: > - github.event.pull_request.head.repo.full_name == github.repository && + github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/v') && !github.event.pull_request.draft uses: ./.github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 979d95a3..1b75dc96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,10 +12,14 @@ jobs: name: Check permissions runs-on: ubuntu-latest outputs: - release_allowed: ${{ steps.maintainer.outputs.is_maintainer == 'true' }} + release_allowed: > + ${{ + steps.maintainer.outputs.is_maintainer == 'true' && + steps.local_branch.outputs.is_local == 'true' + }} steps: - - name: Is maintainer + - name: Initated by a maintainer id: maintainer env: GH_TOKEN: ${{ github.token }} @@ -31,6 +35,13 @@ jobs: echo "is_maintainer=true" >> $GITHUB_OUTPUT fi + - name: The ref branch is local + id: local_branch + env: + is_local: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + run: | + echo "is_local=${is_local}" >> $GITHUB_OUTPUT + release: name: Release needs: permissions