Skip to content

Commit

Permalink
Adding checking for release lables to make sure they are supplied bef…
Browse files Browse the repository at this point in the history
…ore merging.
  • Loading branch information
DevOpsDave committed Jan 5, 2024
1 parent a7403c5 commit 7c9a6a9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-for-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check For Release Tag

on:
pull_request:
branches: [ master ]

jobs:
check_for_release_tag:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# checkout the master branch to compare changelog.txt
- uses: actions/checkout@v2
with:
ref: master
path: ./masterbranch

- name: Verify that a release label exists on the PR
if: ${{ ! ( contains(github.event.pull_request.labels.*.name, 'release/patch') || contains(github.event.pull_request.labels.*.name, 'release/minor') || contains(github.event.pull_request.labels.*.name, 'release/major') || contains(github.event.pull_request.labels.*.name, 'release/skip') ) }}
run: echo "Please label your PR with a release label" && exit 1

# ensure changelog.txt has been updated in this PR by comparing it to the one in the master branch
- name: Verify that changelog.txt has been updated
if: ${{ contains(github.event.pull_request.labels.*.name, 'release/patch') || contains(github.event.pull_request.labels.*.name, 'release/minor') || contains(github.event.pull_request.labels.*.name, 'release/major') }}
run: |
! cmp --silent <(tail -n+2 changelog.txt) <(tail -n+2 ./masterbranch/changelog.txt) || { echo 'Changelog.txt must be updated for release PRs. Please update changelog.txt' && exit 1 ; }

0 comments on commit 7c9a6a9

Please sign in to comment.