build(deps): bump black from 23.10.1 to 24.4.2 in /lib/spack/docs #1967
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: Commit message & PR title validation | |
on: | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Get diff with base branch | |
id: changed-files | |
run: | | |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} | jq -sR 'split("\n") | map(select(. != "")) | @json' | sed -r 's/^"|"$//g' | tr -s /) | |
echo "changed-files=\"${CHANGED_FILES}\"" >> $GITHUB_OUTPUT | |
- name: Validate commit messages & PR title | |
id: commit-message-validator | |
continue-on-error: true | |
run: | | |
pip install gitpython | |
set -x | |
python ./.github/workflows/validate-commit-message.py --title "${{ github.event.pull_request.title }}" --changed-files "${{ steps.changed-files.outputs.changed-files }}" --commits "${{ github.event.pull_request.commits }}" | |
- name: Show output | |
run: | | |
echo "Faulty commits: ${{ steps.commit-message-validator.outputs.faulty-commits }}" | |
echo "Script failure: ${{ steps.commit-message-validator.outputs.script-failure }}" | |
- name: Add comment to PR | |
if: ${{ steps.commit-message-validator.outputs.faulty-commits == 'true' }} | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
filePath: message_issues.txt | |
reactions: eyes, confused, rocket | |
- name: Fail the action | |
if: ${{ steps.commit-message-validator.outputs.faulty-commits == 'true' || steps.commit-message-validator.outputs.script-failure == 'true' }} | |
run: | | |
echo "Something is not right - failing" | |
exit 1 |