diff --git a/tests/test_nightly_release_template.py b/tests/test_nightly_release_template.py index 482fa1a..ba9b26c 100644 --- a/tests/test_nightly_release_template.py +++ b/tests/test_nightly_release_template.py @@ -43,6 +43,15 @@ def test_checkout_credentials_are_not_persisted(self) -> None: self.assertIn("permissions:\n contents: write", content) self.assertNotIn("actions: write", content) + def test_concurrency_only_cancels_runs_for_the_same_branch(self) -> None: + content = TEMPLATE.read_text(encoding="utf-8") + + self.assertIn( + "group: nightly-release-${{ github.repository }}-${{ github.ref_name }}", + content, + ) + self.assertIn("cancel-in-progress: true", content) + if __name__ == "__main__": unittest.main() diff --git a/workflow-templates/nightly-release.yml b/workflow-templates/nightly-release.yml index f0a0f78..abfd431 100644 --- a/workflow-templates/nightly-release.yml +++ b/workflow-templates/nightly-release.yml @@ -18,7 +18,7 @@ permissions: contents: write concurrency: - group: nightly-release-${{ github.repository }} + group: nightly-release-${{ github.repository }}-${{ github.ref_name }} cancel-in-progress: true jobs: