-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating the uncrustify bot to use the new formatting action. Idea is…
… to just apply the patch the formatting action created.
- Loading branch information
Showing
4 changed files
with
33 additions
and
741 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
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,74 +1,23 @@ | ||
name: Uncrustify the source code | ||
name: Format Pull Request Files | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
env: | ||
bashPass: \033[32;1mPASSED - | ||
bashInfo: \033[33;1mINFO - | ||
bashFail: \033[31;1mFAILED - | ||
bashEnd: \033[0m | ||
|
||
jobs: | ||
Uncrustify: | ||
name: Run_Uncrustify | ||
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }} | ||
Formatting: | ||
name: Run Formatting Check | ||
if: ${{ github.event.issue.pull_request }} && | ||
( ( github.event.comment.body == '/bot run uncrustify' ) || | ||
( github.event.comment.body == '/bot run formatting' ) ) | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- name: Install Utils | ||
run: | | ||
sudo apt-get update && sudo apt-get --assume-yes install software-properties-common curl jq sed | ||
sudo add-apt-repository ppa:git-core/ppa | ||
sudo apt-get update && sudo apt-get --assume-yes install git | ||
git --version | ||
- name: get pullrequest url | ||
run: | | ||
echo ${{ github.event.issue.pull_request.url }} | ||
- name: get upstream repo | ||
id: upstreamrepo | ||
run: | | ||
echo "RemoteRepo=$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.repo.full_name' | sed 's/\"//g')" >> $GITHUB_OUTPUT | ||
- name: get upstream branch | ||
id: upstreambranch | ||
run: | | ||
echo "branchname=$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.ref' | sed 's/\"//g')" >> $GITHUB_OUTPUT | ||
- name: echo upstream repo:branch | ||
run: | | ||
echo ${{ steps.upstreamrepo.outputs.RemoteRepo }}:${{ steps.upstreambranch.outputs.branchname }} | ||
- name: Checkout upstream repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }} | ||
ref: ${{ steps.upstreambranch.outputs.branchname }} | ||
- name: Install Uncrustify | ||
run: | | ||
: # Install Uncrustify | ||
echo "::group::Install Uncrustify" | ||
sudo apt-get update && sudo apt-get --assume-yes install uncrustify | ||
echo "::endgroup::" | ||
- name: Run Uncrustify | ||
run: | | ||
: # Uncrustify on C files while ignoring symlinks. | ||
: # Make a collapsible section in the log to run uncrustify | ||
echo "::group::Uncrustify Check" | ||
uncrustify --version | ||
find . -iname "*.[ch]" | xargs uncrustify --no-backup --replace --if-changed -c tools/uncrustify.cfg -l C | ||
echo "::endgroup::" | ||
echo -e "\033[32;3mUncrustify Formatting Applied\033[0m" | ||
- name: Push changes to upstream repository | ||
run: | | ||
: # Push changes to upstream repository | ||
echo "::group::Push changes to upstream repository" | ||
git config --global --add safe.directory '*' | ||
git config --global user.name 'GitHub Action' | ||
git config --global user.email 'action@github.com' | ||
git add -A | ||
git commit -m "Uncrustify: triggered by comment." | ||
echo "::endgroup::" | ||
git push | ||
if [ "$?" = "0" ]; then | ||
echo -e "\033[32;3mPushed formatting changes, don't forget to run 'git pull'!\033[0m" | ||
exit 0 | ||
else | ||
echo -e "\033[32;31mFailed to push the formatting changes\033[0m" | ||
exit 1 | ||
fi | ||
- name: Apply Formatting Fix | ||
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@v2 | ||
id: check-formatting |
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,3 +1,19 @@ | ||
# Ignore MacOS file system related. | ||
**/*.DS_Store* | ||
|
||
# Ignore build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Dd]ebug_with_Libslirp/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
[Ll]ogs/ | ||
[Bb]uild/ | ||
__pycache__/ | ||
|
||
**/*.d | ||
**/*.o | ||
**/*.su |
Oops, something went wrong.