-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b71eff5
commit a1e4f88
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Migrator comment in diff | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- unlabeled | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
env: | ||
COMMENT: 'generated by polaris-migrator DO NOT COPY' | ||
|
||
jobs: | ||
check-diff: | ||
if: | | ||
!contains(github.event.pull_request.labels.*.name, '🤖Skip Comment 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 for generic migrator comment in diff | ||
run: | | ||
commits="origin/$GITHUB_BASE_REF...origin/$GITHUB_HEAD_REF" | ||
files=$(git diff --name-only --diff-filter=d "$commits" -- "*.scss") | ||
if [ -n "$files" ]; then | ||
echo "SCSS files where modified." | ||
echo "$files" | ||
else | ||
echo "No SCSS files where modified." | ||
exit 0 | ||
fi | ||
filesWithComment=$(git diff --unified=0 --diff-filter=d "$commits" -- $(echo $files) | grep "^\+.*$COMMENT" || true) | ||
if [ -n "$filesWithComment" ]; then | ||
echo "A migrator comment '$COMMENT' was added to a SCSS file in this PR." | ||
echo "Please provide a description for any Stylelint disable comments." | ||
echo "If this is not applicable, you can add the '🤖Skip Comment Check' label to this PR." | ||
exit 1 | ||
else | ||
echo "All good, no migrator comments were added." | ||
fi |