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." +