fix settings in dpl-config.json for LcToK0sP workflow #18
Workflow file for this run
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
--- | |
# Find bad spacing in modified text files | |
name: Space checker | |
on: [push, pull_request] | |
permissions: {} | |
env: | |
MAIN_BRANCH: master | |
jobs: | |
build: | |
name: Space checker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
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 | |
# ignore binary files | |
file -bi "$f" | grep -q "charset=binary" && continue | |
echo "Scanning file: $f" | |
# find tabs | |
if grep -q -P "\t" "$f"; then | |
status_tab=1 | |
echo "::error::Found some tabs:" | |
# print out where they are | |
#grep -P -n "\t" "$f" | |
awk 'i=index($0, "\t") {printf "%i (col. %i): %s\n", NR, i, $0}' "$f" | |
fi | |
# find trailing whitespaces | |
if grep -q " $" "$f"; then | |
status_trail=2 | |
echo "::error::Found some trailing whitespaces:" | |
# print out where they are | |
grep -n " $" "$f" | |
fi | |
done | |
status=$((status_tab + status_trail)) | |
if [ "$status" -ne 0 ]; then | |
# 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 }}) | |
- 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: | |
- Emit spaces when the Tab key is pressed. | |
- Display whitespace characters. | |
- Replace tabs with spaces and remove trailing whitespaces when a file is saved." | |
fi | |
exit $status |