-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signed commit cannot be rebased onto main so rebasing when merging PR has been disabled in favor of the squash commit. Thus we want the PR title to match the expected format: "[area]: [desc]" and max 72 characters" Signed-off-by: Cyril Fougeray <[email protected]>
- Loading branch information
Showing
1 changed file
with
22 additions
and
28 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 |
---|---|---|
@@ -1,33 +1,27 @@ | ||
name: Format & Compliance | ||
on: [pull_request] | ||
name: Pull-Request Compliance | ||
on: | ||
pull_request: | ||
types: [opened, edited, reopened] | ||
|
||
jobs: | ||
check-compliance: | ||
name: Check formatting & commit message compliance | ||
check-pr-title: | ||
name: Check PR title | ||
runs-on: ubuntu-22.04 | ||
container: | ||
image: ghcr.io/worldcoin/${{ vars.DOCKER_IMAGE_NAME }}:${{ vars.DOCKER_IMAGE_TAG }} | ||
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
steps: | ||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3 | ||
with: | ||
path: "${{ github.job }}/orb" | ||
- name: Check formatting | ||
- name: Check title format | ||
run: | | ||
cd "${{ github.job }}/orb" | ||
git config --global --add safe.directory /__w/open-orb-mcu-firmware/open-orb-mcu-firmware | ||
pre-commit run --all-files --config utils/format/pre-commit-config.yaml | ||
- name: Check commit message | ||
run: | | ||
cd "${{ github.job }}/orb" | ||
# Un-shallow | ||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" | ||
# Deepen topic branch; checkout topic branch | ||
git fetch origin ${{ github.event.pull_request.head.ref }} --depth=$(( ${{ github.event.pull_request.commits }} + 1 )) | ||
git checkout ${{ github.event.pull_request.head.ref }} | ||
# Fetch main for common origin | ||
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} --depth=50 | ||
gitlint --config utils/format/.gitlint --commits ${{ github.event.pull_request.base.ref }}.. | ||
- name: Guide to contributing | ||
if: failure() | ||
run: | | ||
echo "Take a look at CONTRIBUTING.md" | ||
# has a colon which separates the area from the description | ||
# max 72 characters | ||
exit_code=0 | ||
if [[ ! ${TITLE} =~ ^[^:]+:.+$ ]]; then | ||
echo "PR title must specify an area and a description, see README.md" | ||
exit_code=1 | ||
fi | ||
if [[ ${#TITLE} -gt 72 ]]; then | ||
echo "PR title is too long, see README.md" | ||
exit_code=1 | ||
fi | ||
exit $exit_code |