Add PayoutsBlockedMinor #4677
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Major version in changeset | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- labeled | |
- unlabeled | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
check-changesets: | |
if: | | |
!contains(github.event.pull_request.labels.*.name, '🤖Skip Major Check') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Fetch all branches | |
run: git fetch --all | |
- name: Checkout the feature branch | |
run: git checkout ${{ github.head_ref }} -- | |
- name: Check major versions in changeset entries | |
run: | | |
commits="origin/${{ github.base_ref }}...origin/${{ github.head_ref }}" | |
changeset_files=$(git diff --name-only --diff-filter=d "$commits" -- ".changeset/*.md") | |
if [[ -z "$changeset_files" ]]; then | |
echo "No changeset files detected" | |
exit 0 | |
fi | |
if ! echo "$changeset_files" | xargs grep -qE "^\s*[\"'].*?[\"']\s*:\s*major\s*$"; then | |
echo "No major version upgrade detected" | |
exit 0 | |
else | |
echo "This PR contains a major version upgrade which is only used for breaking changes." | |
echo "If you are sure you want to perform this action, please add the '🤖Skip Major Check' label" | |
exit 1 | |
fi |