-
Notifications
You must be signed in to change notification settings - Fork 223
82 lines (72 loc) · 2.57 KB
/
format-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Format Check
# Run on all push and pull requests
on:
push:
pull_request:
workflow_call:
# Force bash to apply pipefail option so pipeline failures aren't masked
defaults:
run:
shell: bash
jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
format-checker:
name: Run format check
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Install format checker
run: |
sudo apt-get update && sudo apt-get install clang-format
- name: Checkout bundle
uses: actions/checkout@v3
with:
repository: nasa/cFS
- name: Checkout
uses: actions/checkout@v3
with:
path: repo
- name: Generate format differences
run: |
cd repo
find . -name "*.[ch]" -exec clang-format -i -style=file {} +
git diff > $GITHUB_WORKSPACE/style_differences.txt
- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v3
with:
name: style_differences
path: style_differences.txt
check-commit-message:
name: Check Commit Message
needs: check-for-duplicates
# Only run for pull-requests.
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
# Check each commit message associated with the pull-request against the pattern.
- name: Check each commit message
uses: gsactions/commit-message-checker@v2
if: always()
with:
pattern: '^((Fix|HotFix|Part)\s\#[0-9]+,\s[a-zA-Z0-9]+|Merge\spull\srequest\s\#[0-9]+\s[a-zA-Z0-9]+|IC:\s[a-zA-Z0-9]+)'
error: 'You need at least one "Fix|HotFix|Part #<issue number>, <short description>" line in the commit message.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}