Skip to content

Commit

Permalink
Attempt to fix clang-format workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Jan 16, 2024
1 parent b782140 commit be3a444
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@ jobs:
clangFormatVersion: 14
inplace: true
- run: git diff HEAD > format_patch.txt
- run: if [ "$(cat format_patch.txt)" == "" ] ; then rm format_patch.txt ; fi
- run: if [ "$(cat format_patch.txt)" == "" ] ; then rm format_patch.txt ; else cat format_patch.txt; fi

- uses: actions/upload-artifact@v4
id: upload-artf
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
name: clang format patch
path: format_patch.txt

- name: Artifact ID test
run: |
echo "Artifact ID is ${{ steps.upload-artf.outputs.artifact-id }}"
echo "Link: https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts/${{ steps.upload-artf.outputs.artifact-id }}"
- name: Post artifact in issue comment
uses: mshick/[email protected]
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
message: |
Your PR updated files that did not respect package clang formatting settings. Please apply the patch found [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload-artf.outputs.artifact-id }})
echo "Link: ${{ steps.upload-artf.outputs.artifact-url }}"
# This does not work for PRs from forks.
# - name: Post artifact in issue comment
# uses: mshick/[email protected]
# if: ${{ hashFiles('format_patch.txt') != '' }}
# with:
# message: |
# Your PR updated files that did not respect package clang formatting settings. Please apply the patch found [here](${{ steps.upload-artf.outputs.artifact-url }})

- uses: actions/github-script@v3
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
script: |
core.setFailed('Please download and apply the formatting patch! It is located at the bottom of the summary tab for this workflow.')
core.setFailed('Your PR updated files that did not respect package clang formatting settings. Please download and apply the formatting patch! It is located at the bottom of the summary tab for this workflow and at this link: ${{ steps.upload-artf.outputs.artifact-url }}')

0 comments on commit be3a444

Please sign in to comment.