Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test the Action #119

Merged
merged 5 commits into from
May 30, 2024
Merged

Test the Action #119

merged 5 commits into from
May 30, 2024

Conversation

yu-iskw
Copy link
Owner

@yu-iskw yu-iskw commented May 30, 2024

No description provided.

Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
@yu-iskw yu-iskw changed the title Test The Action Test the Action May 30, 2024
Copy link

coderabbitai bot commented May 30, 2024

Warning

Rate Limit Exceeded

@yu-iskw has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 39 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 6fb1154 and f5a23ae.

Walkthrough

The changes primarily focus on updating SQLFluff versions and paths for additional requirements in the GitHub Actions workflow file. Additionally, the SQL linting reporter has been switched from github-check to github-pr-review. A minor SQL change was also made to a test file.

Changes

File Path Change Summary
.github/workflows/test.yml Updated SQLFluff versions, modified paths for additional requirements, and changed linting reporter.
testdata/test_failed_dbt/models/staging/staging_02.sql Added a new SELECT statement.

Poem

In the code where changes flow,
SQLFluff now shines aglow,
Paths updated, versions new,
Linting's got a fresh review.
Queries hum with added lines,
Progress made, the future shines. 🌟


Tip

Early Access Features
  • gpt-4o model for chat

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
@yu-iskw yu-iskw marked this pull request as ready for review May 30, 2024 01:13
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ff52a62 and 6fb1154.
Files selected for processing (2)
  • .github/workflows/test.yml (4 hunks)
  • testdata/test_failed_dbt/models/staging/staging_02.sql (1 hunks)
Additional Context Used
GitHub Check Runs (3)
runner / sqlfluff (github-check) (3.0.7, testdata/test_failed_dbt/extra_requirements-1.8.txt, .sq... success (3)

testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Select targets should be on a new line unless there is only one select target.

Raw Output:
message:"Select targets should be on a new line unless there is only one select target." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT09" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT09"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Expected line break and no indent before '2'.

Raw Output:
message:"Expected line break and no indent before '2'." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT02" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT02"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Line 5, Position 7: Found unparsable section: '2 3'

Raw Output:
message:"Line 5, Position 7: Found unparsable section: '2 3'" location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"PRS" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_PRS"}

runner / sqlfluff (github-check) (3.0.7, testdata/test_failed_dbt/extra_requirements-1.7.txt, .sq... success (3)

testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Select targets should be on a new line unless there is only one select target.

Raw Output:
message:"Select targets should be on a new line unless there is only one select target." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT09" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT09"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Expected line break and no indent before '2'.

Raw Output:
message:"Expected line break and no indent before '2'." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT02" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT02"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Line 5, Position 7: Found unparsable section: '2 3'

Raw Output:
message:"Line 5, Position 7: Found unparsable section: '2 3'" location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"PRS" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_PRS"}

runner / sqlfluff (github-check) (3.0.7, testdata/test_failed_dbt/extra_requirements-1.6.txt, .sq... success (3)

testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Select targets should be on a new line unless there is only one select target.

Raw Output:
message:"Select targets should be on a new line unless there is only one select target." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT09" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT09"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Expected line break and no indent before '2'.

Raw Output:
message:"Expected line break and no indent before '2'." location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"LT02" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_LT02"}


testdata/test_failed_dbt/models/staging/staging_02.sql: [warning] 1-1:
[sqlfluff-lint] reported by reviewdog 🐶
Line 5, Position 7: Found unparsable section: '2 3'

Raw Output:
message:"Line 5, Position 7: Found unparsable section: '2 3'" location:{path:"testdata/test_failed_dbt/models/staging/staging_02.sql" range:{start:{}}} severity:WARNING source:{name:"sqlfluff" url:"https://github.com/sqlfluff/sqlfluff"} code:{value:"PRS" url:"https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.core.rules.Rule_PRS"}

Additional comments not posted (4)
testdata/test_failed_dbt/models/staging/staging_02.sql (1)

7-7: Correct the SQL syntax to adhere to best practices.

- SELECT
-     1 2 3
+ SELECT
+     1,
+     2,
+     3

This change addresses the issues flagged by SQLFluff, ensuring each select target is on a new line and properly separated by commas.

Likely invalid or redundant comment.

.github/workflows/test.yml (3)

15-15: Updated SQLFluff version to 3.0.7.

This update is crucial for staying up-to-date with the latest features and fixes from SQLFluff.


17-19: Updated paths for extra requirements files.

These updates ensure that the workflow uses the correct versions of additional requirements, aligning with the updated SQLFluff version.


32-32: Changed reporter from github-check to github-pr-review.

This change will alter how linting results are reported, potentially improving the integration with GitHub PR reviews.

Also applies to: 77-77

Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
Comment on lines +22 to +23
grep -e "${SQL_FILE_PATTERN:?}" |
xargs -I% bash -c 'if [[ -f "%" ]] ; then echo "%"; fi' || :)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
grep -e "${SQL_FILE_PATTERN:?}" |
xargs -I% bash -c 'if [[ -f "%" ]] ; then echo "%"; fi' || :)
grep -e "${SQL_FILE_PATTERN:?}" |
xargs -I% bash -c 'if [[ -f "%" ]] ; then echo "%"; fi' || :)

Comment on lines +28 to +31
echo "There is no changed files. The action doesn't scan files."
echo "name=sqlfluff-exit-code::0" >>$GITHUB_OUTPUT
echo "name=reviewdog-return-code::0" >>$GITHUB_OUTPUT
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
echo "There is no changed files. The action doesn't scan files."
echo "name=sqlfluff-exit-code::0" >>$GITHUB_OUTPUT
echo "name=reviewdog-return-code::0" >>$GITHUB_OUTPUT
exit 0
echo "There is no changed files. The action doesn't scan files."
echo "name=sqlfluff-exit-code::0" >>$GITHUB_OUTPUT
echo "name=reviewdog-return-code::0" >>$GITHUB_OUTPUT
exit 0

Comment on lines +45 to +47
pip install --no-cache-dir -r "${EXTRA_REQUIREMENTS_TXT}" --use-deprecated=legacy-resolver
# Make sure the installed modules
pip list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
pip install --no-cache-dir -r "${EXTRA_REQUIREMENTS_TXT}" --use-deprecated=legacy-resolver
# Make sure the installed modules
pip list
pip install --no-cache-dir -r "${EXTRA_REQUIREMENTS_TXT}" --use-deprecated=legacy-resolver
# Make sure the installed modules
pip list

Comment on lines +54 to +57
default_dir="$(pwd)"
cd "$INPUT_WORKING_DIRECTORY"
dbt deps --profiles-dir "${SCRIPT_DIR}/resources/dummy_profiles"
cd "$default_dir"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
default_dir="$(pwd)"
cd "$INPUT_WORKING_DIRECTORY"
dbt deps --profiles-dir "${SCRIPT_DIR}/resources/dummy_profiles"
cd "$default_dir"
default_dir="$(pwd)"
cd "$INPUT_WORKING_DIRECTORY"
dbt deps --profiles-dir "${SCRIPT_DIR}/resources/dummy_profiles"
cd "$default_dir"

Comment on lines +63 to +112
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results="sqlfluff-lint.json"
# shellcheck disable=SC2086,SC2046
sqlfluff lint \
--format json \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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"
sqlfluff_exit_code=$?

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

set -Eeuo pipefail
echo '::endgroup::'

echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail

lint_results_rdjson="sqlfluff-lint.rdjson"
cat <"$lint_results" |
jq -r -f "${SCRIPT_DIR}/to-rdjson.jq" |
tee >"$lint_results_rdjson"

cat <"$lint_results_rdjson" |
reviewdog -f=rdjson \
-name="sqlfluff-lint" \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}"
reviewdog_return_code="${PIPESTATUS[1]}"

echo "name=sqlfluff-results-rdjson::$(cat <"$lint_results_rdjson" | jq -r -c '.')" >>$GITHUB_OUTPUT # Convert to a single line
echo "name=reviewdog-return-code::${reviewdog_return_code}" >>$GITHUB_OUTPUT

set -Eeuo pipefail
echo '::endgroup::'

exit $sqlfluff_exit_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results="sqlfluff-lint.json"
# shellcheck disable=SC2086,SC2046
sqlfluff lint \
--format json \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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"
sqlfluff_exit_code=$?
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
set -Eeuo pipefail
echo '::endgroup::'
echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results_rdjson="sqlfluff-lint.rdjson"
cat <"$lint_results" |
jq -r -f "${SCRIPT_DIR}/to-rdjson.jq" |
tee >"$lint_results_rdjson"
cat <"$lint_results_rdjson" |
reviewdog -f=rdjson \
-name="sqlfluff-lint" \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}"
reviewdog_return_code="${PIPESTATUS[1]}"
echo "name=sqlfluff-results-rdjson::$(cat <"$lint_results_rdjson" | jq -r -c '.')" >>$GITHUB_OUTPUT # Convert to a single line
echo "name=reviewdog-return-code::${reviewdog_return_code}" >>$GITHUB_OUTPUT
set -Eeuo pipefail
echo '::endgroup::'
exit $sqlfluff_exit_code
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results="sqlfluff-lint.json"
# shellcheck disable=SC2086,SC2046
sqlfluff lint \
--format json \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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"
sqlfluff_exit_code=$?
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
set -Eeuo pipefail
echo '::endgroup::'
echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results_rdjson="sqlfluff-lint.rdjson"
cat <"$lint_results" |
jq -r -f "${SCRIPT_DIR}/to-rdjson.jq" |
tee >"$lint_results_rdjson"
cat <"$lint_results_rdjson" |
reviewdog -f=rdjson \
-name="sqlfluff-lint" \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}"
reviewdog_return_code="${PIPESTATUS[1]}"
echo "name=sqlfluff-results-rdjson::$(cat <"$lint_results_rdjson" | jq -r -c '.')" >>$GITHUB_OUTPUT # Convert to a single line
echo "name=reviewdog-return-code::${reviewdog_return_code}" >>$GITHUB_OUTPUT
set -Eeuo pipefail
echo '::endgroup::'
exit $sqlfluff_exit_code

Comment on lines +117 to +163
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
# shellcheck disable=SC2086,SC2046
sqlfluff fix \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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
sqlfluff_exit_code=$?
echo "name=sqlfluff-exit-code::${sqlfluff_exit_code}" >>$GITHUB_OUTPUT

set -Eeuo pipefail
echo '::endgroup::'

# SEE https://github.com/reviewdog/action-suggester/blob/master/script.sh
echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail

# Suggest the differences
temp_file=$(mktemp)
git diff | tee "${temp_file}"
git stash -u

# shellcheck disable=SC2034
reviewdog \
-name="sqlfluff-fix" \
-f=diff \
-f.diff.strip=1 \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}" <"${temp_file}" || exit_code=$?

# Clean up
git stash drop || true
set -Eeuo pipefail
echo '::endgroup::'

exit $sqlfluff_exit_code
# exit $exit_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
# shellcheck disable=SC2086,SC2046
sqlfluff fix \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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
sqlfluff_exit_code=$?
echo "name=sqlfluff-exit-code::${sqlfluff_exit_code}" >>$GITHUB_OUTPUT
set -Eeuo pipefail
echo '::endgroup::'
# SEE https://github.com/reviewdog/action-suggester/blob/master/script.sh
echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
# Suggest the differences
temp_file=$(mktemp)
git diff | tee "${temp_file}"
git stash -u
# shellcheck disable=SC2034
reviewdog \
-name="sqlfluff-fix" \
-f=diff \
-f.diff.strip=1 \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}" <"${temp_file}" || exit_code=$?
# Clean up
git stash drop || true
set -Eeuo pipefail
echo '::endgroup::'
exit $sqlfluff_exit_code
# exit $exit_code
echo '::group:: Running sqlfluff 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
# shellcheck disable=SC2086,SC2046
sqlfluff fix \
$(if [[ "x${SQLFLUFF_CONFIG}" != "x" ]]; then echo "--config ${SQLFLUFF_CONFIG}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$(if [[ "x${SQLFLUFF_PROCESSES}" != "x" ]]; then echo "--processes ${SQLFLUFF_PROCESSES}"; fi) \
$(if [[ "x${SQLFLUFF_RULES}" != "x" ]]; then echo "--rules ${SQLFLUFF_RULES}"; fi) \
$(if [[ "x${SQLFLUFF_EXCLUDE_RULES}" != "x" ]]; then echo "--exclude-rules ${SQLFLUFF_EXCLUDE_RULES}"; fi) \
$(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
sqlfluff_exit_code=$?
echo "name=sqlfluff-exit-code::${sqlfluff_exit_code}" >>$GITHUB_OUTPUT
set -Eeuo pipefail
echo '::endgroup::'
# SEE https://github.com/reviewdog/action-suggester/blob/master/script.sh
echo '::group:: Running reviewdog 🐶 ...'
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
# Suggest the differences
temp_file=$(mktemp)
git diff | tee "${temp_file}"
git stash -u
# shellcheck disable=SC2034
reviewdog \
-name="sqlfluff-fix" \
-f=diff \
-f.diff.strip=1 \
-reporter="${REVIEWDOG_REPORTER}" \
-filter-mode="${REVIEWDOG_FILTER_MODE}" \
-fail-on-error="${REVIEWDOG_FAIL_ON_ERROR}" \
-level="${REVIEWDOG_LEVEL}" <"${temp_file}" || exit_code=$?
# Clean up
git stash drop || true
set -Eeuo pipefail
echo '::endgroup::'
exit $sqlfluff_exit_code
# exit $exit_code

Comment on lines +166 to +167
echo 'ERROR: SQLFLUFF_COMMAND must be one of lint and fix'
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
echo 'ERROR: SQLFLUFF_COMMAND must be one of lint and fix'
exit 1
echo 'ERROR: SQLFLUFF_COMMAND must be one of lint and fix'
exit 1

@yu-iskw yu-iskw merged commit afce554 into main May 30, 2024
25 of 40 checks passed
@yu-iskw yu-iskw deleted the test-action branch May 30, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant