Ensure all PRs to release to be tagged.

Will be enforced via branch protection.
This commit is contained in:
Dominik Moritz Roth 2024-01-18 11:01:13 +01:00
parent 3cac0a9258
commit 992ee014a3

View File

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