-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from elijahr/updates
Update various dependencies
- Loading branch information
Showing
17 changed files
with
127 additions
and
181 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 |
---|---|---|
@@ -1,38 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ueo pipefail | ||
# Run lintball using Docker on git commit | ||
|
||
# Ensure ARM64 homebrew and /usr/local/bin are in PATH before system PATH. | ||
# This finds /usr/local/bin/lintball and finds newer Homebrew-installed bash. | ||
export PATH | ||
PATH=~/.asdf/shims":/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:$PATH" | ||
set -eu | ||
|
||
export LINTBALL_DIR | ||
LINTBALL_DIR="${LINTBALL_DIR:-node_modules/lintball}" | ||
workspace=$(git rev-parse --show-toplevel || true) | ||
if [[ -z ${workspace} ]]; then | ||
echo "Could not determine git repository path" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -f "${LINTBALL_DIR}/bin/lintball" ]; then | ||
"${LINTBALL_DIR}/bin/lintball" pre-commit | ||
elif [ -n "$(command -v lintball)" ]; then | ||
lintball pre-commit | ||
if [[ -f "${workspace}/scripts/build-local-docker-image.sh" ]]; then | ||
# This is lintball itself, build and use the local image | ||
"${workspace}/scripts/build-local-docker-image.sh" | ||
image=lintball:local | ||
else | ||
{ | ||
echo | ||
echo "Error: could not find a lintball executable, but lintball's pre-commit hook is enabled." | ||
echo | ||
echo "Solutions:" | ||
echo | ||
echo '- Install lintball globally:' | ||
echo ' npm install -g lintball' | ||
echo '- And/or, ensure that that lintball can be found in PATH:' | ||
# shellcheck disable=SC2016 | ||
echo ' ln -s "$(command -v lintball)" /usr/local/bin/' | ||
echo | ||
echo 'Workarounds:' | ||
echo | ||
echo '- Disable all git hooks:' | ||
echo ' git config --local core.hooksPath ""' | ||
echo "- Delete ${BASH_SOURCE[0]}" | ||
echo | ||
} >&2 | ||
exit 1 | ||
image=elijahru/lintball:latest | ||
fi | ||
|
||
docker run -v "${workspace}:/workspace" "${image}" lintball pre-commit |
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
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
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
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,74 +1,24 @@ | ||
name: lint | ||
|
||
name: Lint | ||
# yamllint disable rule:truthy | ||
on: | ||
pull_request: | ||
branches: ['*'] | ||
branches: ["*"] | ||
push: | ||
branches: ['*'] | ||
tags: ['*'] | ||
branches: ["*"] | ||
tags: ["*"] | ||
# yamllint enable rule:truthy | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
name: lint | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
node-version: '15' | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install shfmt | ||
uses: mfinelli/setup-shfmt@v2 | ||
|
||
- name: Install lintball | ||
run: | | ||
npm install -g [email protected] | ||
lintball install-tools --yes sh yml md | ||
- name: Check for linter issues | ||
shell: bash | ||
run: | | ||
set -uexo pipefail | ||
fetch-depth: 0 # This is necessary for linting only recent changes | ||
|
||
default_branch=main | ||
if [ "$GITHUB_REF" = "refs/heads/$default_branch" ]; then | ||
# A push to the default branch. | ||
# Check files which were changed in the most recent commit. | ||
commitish="HEAD~1" | ||
elif [ -n "$GITHUB_BASE_REF" ]; then | ||
# A pull request. | ||
# Check files which have changed between the merge base and the | ||
# current commit. | ||
commitish="$(git merge-base -a refs/remotes/origin/$GITHUB_BASE_REF $GITHUB_SHA)" | ||
else | ||
# A push to a non-default, non-PR branch. | ||
# Check files which have changed between default branch and the current | ||
# commit. | ||
commitish="$(git merge-base -a refs/remotes/origin/${default_branch} $GITHUB_SHA)" | ||
fi | ||
# Get the list of changed files | ||
files="$(git diff --name-only "$commitish")" | ||
# Check if any lintball configuration was changed. If so, check all files. | ||
status=0 | ||
case "$files" in | ||
*lintballrc.json* | *.yamllint.yml* | *lint.yml*) lintball check || status=$? ;; | ||
*) lintball check --since "$commitish" || status=$? ;; | ||
esac | ||
if [ "$status" -gt 0 ]; then | ||
echo | ||
echo "The above issues were found by lintball." | ||
echo "To detect and auto-fix issues before pushing, install lintball's git hooks." | ||
echo "See https://github.com/elijahr/lintball" | ||
echo | ||
exit $status | ||
fi | ||
- name: Run lintball | ||
uses: elijahr/lintball@v2 |
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
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 @@ | ||
disable=SC2154,SC2312,SC2310 |
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,6 +1,6 @@ | ||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
- "*.yaml" | ||
- "*.yml" | ||
|
||
rules: | ||
braces: enable | ||
|
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
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
Oops, something went wrong.