-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add shellcheck to CI * fix shellcheck warnings * rename shellcheck to shell in workflow
- Loading branch information
1 parent
f7141b4
commit e2a7a3e
Showing
3 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Shell | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run shellcheck | ||
uses: ludeeus/[email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#!/bin/bash | ||
# | ||
# Checks if the source code contains required license and adds it if necessary. | ||
# Returns 1 if there was a missing license, 0 otherwise. | ||
|
||
PAT_APA="^// Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT$" | ||
PAT_APA="^// Copyright 2019-2022 ChainSafe Systems// SPDX-License-Identifier: Apache-2.0, MIT$" | ||
|
||
valid=true | ||
for file in $(find . -type f -not -path "./target/*" -not -path "./blockchain/beacon/src/drand_api/*" -not -path "./ipld/graphsync/src/message/proto/message.rs" | egrep '\.(rs)$'); do | ||
header=$(echo $(head -3 $file)) | ||
ret=0 | ||
for file in $(find . -type f -not -path "./target/*" -not -path "./blockchain/beacon/src/drand_api/*" -not -path "./ipld/graphsync/src/message/proto/message.rs" | grep -E '\.(rs)$'); do | ||
header=$(head -2 "$file" | tr -d '\n') | ||
if ! echo "$header" | grep -q "$PAT_APA"; then | ||
echo "$file was missing header" | ||
cat ./scripts/copyright.txt $file > temp | ||
mv temp $file | ||
valid=false | ||
cat ./scripts/copyright.txt "$file" > temp | ||
mv temp "$file" | ||
ret=1 | ||
fi | ||
done | ||
|
||
# if a header is incorrect, return an OS exit code | ||
if [ "$valid" = false ] ; then | ||
exit 1 | ||
fi | ||
exit $ret |
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