Skip to content

Commit

Permalink
fix(ci): sort .license.ignore locally before diff (#4106)
Browse files Browse the repository at this point in the history
Description
---

- sorts license.ignore localy before diffing

Motivation and Context
---
The license check does not always pass. I'm not really able to explain why it is flaky but on my local linux machine
it does not pass because the `sort` command behaves slightly differently. 

This PR sorts the ignore file locally so that we can be sure the sorting is consistent before the diff.

How Has This Been Tested?
---
Manually run ./scripts/file_license_check.sh
  • Loading branch information
sdbondi authored May 17, 2022
1 parent 50993a3 commit 8594754
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/file_license_check.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/bash
# run from the repo root
# Must be run from the repo root

rg -i "Copyright.*The Tari Project" --files-without-match \
-g '!*.{Dockerfile,asc,bat,config,config.js,css,csv,drawio,gitkeep,hbs,html,iss,json,lock,md,min.js,ps1,py,rc,scss,sh,sql,svg,toml,txt,yml,vue}' . \
| sort >/tmp/rgtemp
| sort > /tmp/rgtemp

DIFFS=$(diff -u .license.ignore /tmp/rgtemp)
# sort the .license.ignore file as sorting seems to behave differently on different platforms
cat .license.ignore | sort > /tmp/.license.ignore

DIFFS=$(diff -u /tmp/.license.ignore /tmp/rgtemp)

if [ -n "$DIFFS" ]; then
echo "New files detected that either need copyright/license identifiers added, or they need to be added to .license.ignore"
Expand Down

0 comments on commit 8594754

Please sign in to comment.