ci: make bazel buildifier job incremental #36
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
# yamllint disable rule:line-length | |
--- | |
name: PR description | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
types: [opened, edited, synchronize] | |
jobs: | |
check-description: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check PR description for 'Issue:' link | |
id: contains_issue | |
run: | | |
PR_BODY=$(curl -s https://api.github.com/repos/${{ | |
github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .body) | |
echo "$PR_BODY" | |
pattern="https://github\.com/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/issues/([0-9]+)" | |
if [[ ! "$PR_BODY" =~ $pattern ]]; then | |
echo "Error: PR description must include an issue link in the format 'Issue: # 123' or 'Issue: https://github.com/owner/repo/issues/123'." >&2 | |
exit 1 | |
else | |
echo "PR description contains a valid issue link." | |
fi | |
- name: Fail PR if no issue link found | |
if: failure() | |
run: |- | |
echo "Please add an issue link in the format 'Issue: # 123' or 'Issue: https://github.com/owner/repo/issues/123' in the PR description." |