From 992ee014a3fd367a8e7698c75d8672ec04ef3f3c Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Thu, 18 Jan 2024 11:01:13 +0100 Subject: [PATCH] Ensure all PRs to release to be tagged. Will be enforced via branch protection. --- .github/workflows/ensure-release-tagged.yaml | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ensure-release-tagged.yaml diff --git a/.github/workflows/ensure-release-tagged.yaml b/.github/workflows/ensure-release-tagged.yaml new file mode 100644 index 0000000..1b79d51 --- /dev/null +++ b/.github/workflows/ensure-release-tagged.yaml @@ -0,0 +1,26 @@ +name: Ensure Tagged Commits on Release + +on: + pull_request: + branches: + - release + +jobs: + check_tag: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Check if base commit of PR is tagged + run: | + BASE_COMMIT=$(jq -r .pull_request.base.sha < "$GITHUB_EVENT_PATH") + TAG=$(git tag --contains $BASE_COMMIT) + if [ -z "$TAG" ]; then + echo "Base commit of PR is not tagged. PRs onto release must be tagged with the version number." + exit 1 + fi + echo "Base commit of PR is tagged. Check passed." +