diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 11d43b6d..fa7b5588 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -17,6 +17,13 @@ concurrency: jobs: release-please: + # Release PRs squash to this prefix. Skip that push so release.yml can create + # the tag before the next conventional commit or manual dispatch scans again. + if: >- + ${{ + github.event_name == 'workflow_dispatch' || + !startsWith(github.event.head_commit.message, 'chore(release): v') + }} runs-on: ubuntu-latest timeout-minutes: 10 env: diff --git a/scripts/test_release_please_config.py b/scripts/test_release_please_config.py index 3d573160..dd97fa0a 100644 --- a/scripts/test_release_please_config.py +++ b/scripts/test_release_please_config.py @@ -45,6 +45,16 @@ def test_release_please_workflow_is_pr_only_and_staged() -> None: assert "if: ${{ env.RELEASE_PLEASE_TOKEN != '' }}" in workflow assert "if: ${{ env.RELEASE_PLEASE_TOKEN == '' }}" in workflow + release_commit_guard = """\ + if: >- + ${{ + github.event_name == 'workflow_dispatch' || + !startsWith(github.event.head_commit.message, 'chore(release): v') + }} +""" + release_job = workflow[workflow.index(" release-please:\n") :] + assert release_commit_guard in release_job + release_workflow = (ROOT / ".github/workflows/release.yml").read_text() assert "predates scripts/release_changelog_section.py" in release_workflow assert "python3 scripts/release_changelog_section.py" not in release_workflow