Skip to content

Commit

Permalink
Merge pull request #1 from gorgias/implement-fixes-git-unshallow
Browse files Browse the repository at this point in the history
fix: use depth for git fetch and fix output
  • Loading branch information
aballiet authored Dec 4, 2023
2 parents 62f4245 + ccb4909 commit 0e3aaf3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ git config --global --add safe.directory /github/workspace
echo '::group::🐶 Get changed files'
# The command is necessary to get changed files.
# TODO Fetch only the target branch
git fetch --prune --unshallow --no-tags
git fetch --prune --depth 10000 --no-tags

SQL_FILE_PATTERN="${FILE_PATTERN:?}"
SOURCE_REFERENCE="origin/${GITHUB_PULL_REQUEST_BASE_REF:?}"
Expand Down Expand Up @@ -75,9 +75,10 @@ if [[ "${SQLFLUFF_COMMAND:?}" == "lint" ]]; then
$(if [[ "x${SQLFLUFF_TEMPLATER}" != "x" ]]; then echo "--templater ${SQLFLUFF_TEMPLATER}"; fi) \
$(if [[ "x${SQLFLUFF_DISABLE_NOQA}" != "x" ]]; then echo "--disable-noqa ${SQLFLUFF_DISABLE_NOQA}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$changed_files |
tee "$lint_results"
$changed_files >> "$lint_results"

sqlfluff_exit_code=$?
cat "$lint_results"

echo "name=sqlfluff-results::$(cat <"$lint_results" | jq -r -c '.')" >> $GITHUB_OUTPUT # Convert to a single line
echo "name=sqlfluff-exit-code::${sqlfluff_exit_code}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 0e3aaf3

Please sign in to comment.