Skip to content

Commit 16db7c4

Browse files
committed
ci: switch to common formalities workflow
Switch to using the common formalities workflow defined in the actions-shared-workflows. Signed-off-by: George Sapkin <george@sapk.in>
1 parent 5e86748 commit 16db7c4

1 file changed

Lines changed: 11 additions & 56 deletions

File tree

.github/workflows/formal.yml

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,16 @@ name: Test Formalities
33
on:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
610
jobs:
7-
build:
11+
formalities:
812
name: Test Formalities
9-
runs-on: ubuntu-latest
10-
strategy:
11-
fail-fast: false
12-
13-
steps:
14-
- uses: actions/checkout@v2
15-
with:
16-
ref: ${{ github.event.pull_request.head.sha }}
17-
fetch-depth: 0
18-
19-
- name: Determine branch name
20-
run: |
21-
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
22-
echo "Building for $BRANCH"
23-
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
24-
25-
- name: Test formalities
26-
run: |
27-
source .github/workflows/ci_helpers.sh
28-
29-
RET=0
30-
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
31-
info "=== Checking commit '$commit'"
32-
if git show --format='%P' -s $commit | grep -qF ' '; then
33-
err "Pull request should not include merge commits"
34-
RET=1
35-
fi
36-
37-
author="$(git show -s --format=%aN $commit)"
38-
if echo $author | grep -q '\S\+\s\+\S\+'; then
39-
success "Author name ($author) seems ok"
40-
else
41-
err "Author name ($author) need to be your real name 'firstname lastname'"
42-
RET=1
43-
fi
44-
45-
subject="$(git show -s --format=%s $commit)"
46-
if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then
47-
success "Commit subject line seems ok ($subject)"
48-
else
49-
err "Commit subject line MUST start with '<package name>: ' ($subject)"
50-
RET=1
51-
fi
52-
53-
body="$(git show -s --format=%b $commit)"
54-
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
55-
if echo "$body" | grep -qF "$sob"; then
56-
success "Signed-off-by match author"
57-
else
58-
err "Signed-off-by is missing or doesn't match author (should be '$sob')"
59-
RET=1
60-
fi
61-
done
62-
63-
exit $RET
13+
uses: openwrt/actions-shared-workflows/.github/workflows/formal.yml@main
14+
# with:
15+
# # Post formality check summaries to the PR.
16+
# # Repo's permissions need to be updated for actions to modify PRs:
17+
# # https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment
18+
# post_comment: true

0 commit comments

Comments
 (0)