Skip to content

Commit

Permalink
Add a header check to the CI Fix rucio#4980
Browse files Browse the repository at this point in the history
The `add_header` script needs to be run after an edit to determine the status of
the header and, if necessary, change the header.

This commit adds the check for the header to the CI/CD. This enforces the usage
of the `add_header` script and ensures a healthy code base.
  • Loading branch information
Joel Dierkes committed Jan 17, 2022
1 parent d19db9e commit 7711422
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/autotest.yml
Expand Up @@ -5,6 +5,24 @@ on:
- push

jobs:
header-lint:
if: 'github.event_name == ''pull_request'''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check headers
run: |
git pull origin master
echo "Current git rev $(git rev-parse HEAD)"
echo "Common ancestor git rev $(git merge-base HEAD remotes/origin/master)"
echo "If a file header needs to be changed run 'tools/add_header -i FILE' from the rucio project directory."
FILES=$(git diff --name-status HEAD $(git merge-base HEAD remotes/origin/master) | grep -v '^A' | cut -f 2 | grep -E '\.py$|^bin/')
echo "Files to check: $FILES"
if [[ -n $FILES ]]; then
tools/add_header --disable-add-me -cd $FILES
fi
setup:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 7711422

Please sign in to comment.