Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify space checker #472

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/space-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed to get the full history
- name: Fetch upstream
run: |
# Fetch the main upstream branch to find the common ancestor
git config --global user.name "Nemo" # required on some servers
git remote add upstream https://github.com/AliceO2Group/Run3Analysisvalidation.git || exit 1
git fetch upstream ${{ env.MAIN_BRANCH }} || exit 1
- name: Find bad spacing
run: |
# Find tabs and trailing whitespaces in modified text files and show where they are
status_tab=0
status_trail=0
# Get the common ancestor of the current branch and the main upstream branch
BASE_COMMIT=$(git merge-base HEAD upstream/${{ env.MAIN_BRANCH }})
echo "Diffing against: $BASE_COMMIT"
# loop over changed files
for f in $(git diff --diff-filter d --name-only "$BASE_COMMIT"); do
# Diff against the common ancestor of the source branch and the main branch.
for f in $(git diff --diff-filter d --name-only origin/${{ env.MAIN_BRANCH }}...); do
# ignore binary files
file -bi "$f" | grep -q "charset=binary" && continue
echo "Scanning file: $f"
Expand All @@ -54,7 +46,7 @@ jobs:
# shellcheck disable=2028
echo "::warning::Fix the errors in your editor (or with a command)
Command tips:
- Get list of files you changed: git diff --diff-filter d --name-only \$(git merge-base HEAD upstream/${{ env.MAIN_BRANCH }})
- Get list of files you changed: git diff --diff-filter d --name-only ${{ env.MAIN_BRANCH }}...
- Replace each tab with two spaces: sed -i 's/\\t/ /g' <files>
- Remove trailing whitespaces: sed -i 's/[[:space:]]*$//' <files>"
echo "::warning::To avoid these errors, configure your editor to:
Expand Down