Version Packages #9385
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: 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 |