Skip to content

Commit

Permalink
style: address lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Sep 13, 2022
1 parent aeb840a commit 30387a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ runs:
env:
DIFF_PATHS: ${{ inputs.pathspec }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: ${{ github.action_path }}/scripts/index.sh ${{ inputs.file }}
run: ${{ github.action_path }}/scripts/index.sh
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
echo "this step will only run if specific files have changed"
```
> ⚠️ when running on `push` events, a `fetch-depth` of `0` higher is required.
> ⚠️ when running on `push` events, a `fetch-depth` of `0` or higher is required.

## `push` vs `pull_request`

Expand Down
8 changes: 4 additions & 4 deletions scripts/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ if [[ $GITHUB_EVENT_NAME != "push" && $GITHUB_EVENT_NAME != "pull_request" ]]; t
fi

if [[ -z $BASE_SHA && $GITHUB_EVENT_NAME == "push" ]]; then
BASE_SHA="HEAD~$(jq '.commits | length' "$GITHUB_EVENT_PATH")" # push events
BASE_SHA="HEAD~$(jq '.commits | length' "${GITHUB_EVENT_PATH}")" # push events
fi

CHANGED=$(git diff --exit-code --quiet ${BASE_SHA} HEAD -- $DIFF_PATHS && echo 'false' || echo 'true')
FILES=$(git diff --name-only ${BASE_SHA} HEAD -- $DIFF_PATHS | tr '\n' ' ')
CHANGED="$(git diff --exit-code --quiet "${BASE_SHA}" HEAD -- "${DIFF_PATHS}" && echo 'false' || echo 'true')"
FILES="$(git diff --name-only "${BASE_SHA}" HEAD -- "${DIFF_PATHS}" | tr '\n' ' ')"

echo "::set-output name=changed::${CHANGED}"
echo "::set-output name=files::${FILES}"
echo "::set-output name=json::$(jq --compact-output --null-input '$ARGS.positional' --args -- ${FILES})"
echo "::set-output name=json::$(jq --compact-output --null-input '$ARGS.positional' --args -- "${FILES}")"

0 comments on commit 30387a6

Please sign in to comment.