Skip to content

Commit

Permalink
chore: add ShellCheck action (#7)
Browse files Browse the repository at this point in the history
* chore: add ShellCheck action

* suggestions from ShellCheck

* suggestions from ShellCheck

* use jq --arg instead of ShellCheck's suggestion

* fix: actionlint and shellcheck workflow triggers

* chore: bump checkout action version in actionlint.yml

---------

Co-authored-by: austinletson <[email protected]>
  • Loading branch information
kim-em and austinletson authored May 9, 2024
1 parent 3c111d3 commit 788e73f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Actionlint
on:
push:
branches:
- 'main'
paths:
- '.github/**'
pull_request:
paths:
- '.github/**'

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: actionlint
uses: raven-actions/actionlint@v1
with:
pyflakes: false # we do not use python scripts
15 changes: 15 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ShellCheck
on:
push:
branches:
- 'main'
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run ShellCheck
uses: azohra/[email protected]
8 changes: 4 additions & 4 deletions scripts/check_reservoir_eligibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function check_license() {
SPDX_DATA_URL="https://raw.githubusercontent.com/spdx/license-list-data/main/json/licenses.json"

# Fetch the SPDX license list and filter by licenseId and isOsiApproved
license=$(curl -s $SPDX_DATA_URL | jq -r '.licenses[] | select(.licenseId == "'$id'" and .isOsiApproved == true)')
license=$(curl -s "$SPDX_DATA_URL" | jq -r --arg id "$id" '.licenses[] | select(.licenseId == $id and .isOsiApproved == true)')
if [ -n "$license" ]; then
return 0
else
Expand All @@ -24,7 +24,7 @@ function check_license() {
}

# Check if the license_id is a valid SPDX license and assign exit code
if ! check_license $license_id; then
if ! check_license "$license_id"; then
echo "Package is ineligible for Reservoir because the repository does not contain a valid SPDX license."
exit_code=1
fi
Expand All @@ -36,13 +36,13 @@ if [ ! -f "lake-manifest.json" ]; then
fi

# Check if the repository is private
if [ $private == "true" ]; then
if [ "$private" == "true" ]; then
echo "Package is ineligible for Reservoir because the repository is private."
exit_code=1
fi

# Check if the repository has less than 2 stars
if [ $number_of_stars -lt 2 ]; then
if [ "$number_of_stars" -lt 2 ]; then
echo "Package is ineligible for Reservoir because the repository has less than 2 stars."
exit_code=1
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_elan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v1.4.2/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> $GITHUB_PATH
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"

0 comments on commit 788e73f

Please sign in to comment.