Skip to content

Commit

Permalink
CI default branch variable
Browse files Browse the repository at this point in the history
  • Loading branch information
non-det-alle committed Oct 13, 2024
1 parent 5b9e206 commit 0d42333
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
container:
image: python:latest
timeout-minutes: 60
env:
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
steps:
- uses: actions/checkout@v4
- run: pip install codespell
Expand All @@ -65,9 +67,8 @@ jobs:
git remote remove upstream ;
fi
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
# develop here is meant to be the "default branch"
- run: git remote add -t develop --no-tags -f upstream https://github.com/signetlabdei/lorawan.git
- run: git log --pretty=%B HEAD...upstream/develop ^upstream/develop > git_messages.txt
- run: git remote add -t $CI_DEFAULT_BRANCH --no-tags -f upstream https://github.com/signetlabdei/lorawan.git
- run: git log --pretty=%B HEAD...upstream/$CI_DEFAULT_BRANCH ^upstream/$CI_DEFAULT_BRANCH > git_messages.txt
# Check source code and commit messages
- run: codespell -f -C0 --skip="./experiments" ./

Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,26 @@ jobs:
- name: "Running clang-tidy"
shell: bash
run: >
if [[ $GITHUB_REF_NAME == $CI_DEFAULT_BRANCH ]] ; then
echo "Running full clang-tidy" ;
git -C src/lorawan/ tag empty $(git hash-object -t tree /dev/null) &&
git -C src/lorawan/ diff -U0 empty
--src-prefix=a/src/lorawan/ --dst-prefix=b/src/lorawan/ |
clang-tidy-diff-18.py -path cmake-cache/ -p1 -quiet -use-color
-iregex "src\/lorawan\/.+\.(cpp|cc|cxx|c|h|hpp)"
1> $CLANG_TIDY_OUTPUT
2> /dev/null || true
2> /dev/null ;
else
echo "Running clang-tidy-diff" ;
git -C src/lorawan/ diff -U0 upstream/$CI_DEFAULT_BRANCH
--src-prefix=a/src/lorawan/ --dst-prefix=b/src/lorawan/ |
clang-tidy-diff-18.py -path cmake-cache/ -p1 -quiet -use-color
-iregex "src\/lorawan\/.+\.(cpp|cc|cxx|c|h|hpp)"
1> $CLANG_TIDY_OUTPUT
2> /dev/null || true ;
fi
env:
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
- name: "Trim empty lines from output file"
run: sed -i '/^$/d' $CLANG_TIDY_OUTPUT
- name: "Check job results"
Expand Down

0 comments on commit 0d42333

Please sign in to comment.