Fast-Tracked cFE Pull Requests: Resolves cFE#2421 and cFE#2423. #682
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: 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 github pull-request title against the pattern. | |
- name: Check pull-request title | |
uses: gsactions/commit-message-checker@v2 | |
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 pull-request title.' | |
excludeDescription: 'true' | |
excludeTitle: 'false' | |
checkAllCommitMessages: 'false' | |
# 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 }} |