From c99bc118ff8ec2d674a4af472d3776e1507e64cd Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:16:58 -0400 Subject: [PATCH 01/19] Adapt isort-action more closely --- LICENSE | 2 ++ README.md | 2 +- action.yml | 45 ++++++++++++++++++++++++++++++++++++++--- bin/ensure_python | 12 +++++++++++ bin/install_packages | 22 ++++++++++++++++++++ bin/run_fawltydeps | 18 +++++++++++++++++ fawltydeps-matcher.json | 23 +++++++++++++++++++++ 7 files changed, 120 insertions(+), 4 deletions(-) create mode 100755 bin/ensure_python create mode 100755 bin/install_packages create mode 100755 bin/run_fawltydeps create mode 100644 fawltydeps-matcher.json diff --git a/LICENSE b/LICENSE index 49d29e7..4e95194 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,8 @@ MIT License Copyright (c) 2024 Tweag I/O Limited. +Copyright (c) 2022 James W. Curtin and Contributors +Copyright (c) 2018 Ɓukasz Langa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 31e92f4..7f2fb78 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ More advanced example with extra command line options: ## Documentation -This action was inspired by the [black]() and [isort-action]() GitHub actions. It currently uses the Docker method of executing actions. +This action was inspired by and partially derived from the MIT-licensed [black](https://black.readthedocs.io/en/stable/integrations/github_actions.html) and [isort-action](https://github.com/isort/isort-action) GitHub actions. ## Development diff --git a/action.yml b/action.yml index 798a131..a230d5d 100644 --- a/action.yml +++ b/action.yml @@ -1,19 +1,58 @@ name: 'FawltyDeps' description: 'Check a Python project for _undeclared_ and _unused_ 3rd party dependencies' -# Inspired by and adapted from https://github.com/psf/black/blob/main/action.yml + # Inspired by and adapted from: + # https://github.com/psf/black/blob/main/action.yml + # https://github.com/isort/isort-action inputs: options: description: "Options passed to fawltydeps. Use `fawltydeps --help` to see available options. Default: ''" required: false default: "" + requirements-files: + description: > + path(s) to requirements files that should be installed to properly + configure third-party imports + required: false + paths: + description: > + files or directories to scan for dependency issues + required: false + default: . branding: color: "purple" icon: "check-circle" +outputs: + fawltydeps-result: + description: fawltydeps result + value: ${{ steps.run-fawltydeps.outputs.fawltydeps-output }} runs: - using: 'docker' - image: 'Dockerfile' + using: 'composite' + steps: + - run: $GITHUB_ACTION_PATH/bin/ensure_python + shell: bash + args: - fawltydeps - ${{ inputs.options }} +runs: + using: composite + steps: + - run: $GITHUB_ACTION_PATH/bin/ensure_python + shell: bash + - run: > + $GITHUB_ACTION_PATH/bin/install_packages + ${{ inputs.fawltydeps-version }} + ${{ inputs.requirements-files || inputs.requirementsFiles }} + shell: bash + - run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" + shell: bash + - id: run-isort + run: > + $GITHUB_ACTION_PATH/bin/run_fawltydeps + ${{ inputs.options }} + ${{ inputs.paths }} + shell: bash + - run: echo "::remove-matcher owner=fawltydeps-matcher::" + shell: bash diff --git a/bin/ensure_python b/bin/ensure_python new file mode 100755 index 0000000..f57215e --- /dev/null +++ b/bin/ensure_python @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# If Python 3 isn't installed, exit +python3 -V > /dev/null 2>&1 || (echo "python3 is not available. Use the setup-python action" && exit 1) + +# Make sure we're using a supported version of Python +major_version=$(python3 -c 'import sys; print(sys.version_info[0])') +minor_version=$(python3 -c 'import sys; print(sys.version_info[1])') +if [ "$major_version" -lt 3 ] || [ "$minor_version" -lt 6 ]; then + echo "Minimum supported version of python is 3.6, but $(python3 -V) is installed" + exit 1 +fi diff --git a/bin/install_packages b/bin/install_packages new file mode 100755 index 0000000..a2404ac --- /dev/null +++ b/bin/install_packages @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +isort_version=$1 +requirements_files=$2 + +echo "::group::Install isort" +if [ -z "$isort_version" ] || [ "$isort_version" == "latest" ]; then + echo "Installing latest version of isort" + python3 -m pip install "isort[requirements_deprecated_finder,pipfile_deprecated_finder]" +else + echo "Installing isort==$isort_version" + python3 -m pip install "isort[requirements_deprecated_finder,pipfile_deprecated_finder]==$isort_version" +fi +echo "::endgroup::" + +if [ -n "$requirements_files" ]; then + echo "::group::Install modules from requirements arg" + for file in $requirements_files; do + python3 -m pip install -r "$file" + done + echo "::endgroup::" +fi diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps new file mode 100755 index 0000000..1f9fa9d --- /dev/null +++ b/bin/run_fawltydeps @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +echo "Running fawltydeps $*" +fawltydeps_result=$(fawltydeps "$@") +exit_code=$? + +# The fawltydeps output can be a multiline string. By default, GITHUB_OUTPUT expects +# output to be on a single line, so a (random) delimiter needs to be used +# so that the output is parsed properly. +# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings +DELIMITER=$(echo $RANDOM | md5sum | head -c 20) +{ + echo "fawltydeps-output<<${DELIMITER}" + echo "${fawltydeps_result}" + echo "${DELIMITER}" +} >> "${GITHUB_OUTPUT}" + +exit $exit_code diff --git a/fawltydeps-matcher.json b/fawltydeps-matcher.json new file mode 100644 index 0000000..f5b7c58 --- /dev/null +++ b/fawltydeps-matcher.json @@ -0,0 +1,23 @@ +{ + "problemMatcher": [ + { + "owner": "fawltydeps-matcher", + "pattern": [ + { + "regexp": "(These imports appear to be .* dependencies):$", + "message": 1 + }, + { + "regexp": "^- '([^']+)' imported at:$", + "message": 1 + }, + { + "regexp": "^ (.+):([0-9]+)$", + "file": 1, + "line": 2, + "loop": true + } + ] + } + ] +} From c917994521da25f43c8e1197a1b0e12243bde1fd Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:19:33 -0400 Subject: [PATCH 02/19] Clean out cut and paste cruft --- action.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/action.yml b/action.yml index a230d5d..93149e4 100644 --- a/action.yml +++ b/action.yml @@ -26,16 +26,6 @@ outputs: fawltydeps-result: description: fawltydeps result value: ${{ steps.run-fawltydeps.outputs.fawltydeps-output }} -runs: - using: 'composite' - steps: - - run: $GITHUB_ACTION_PATH/bin/ensure_python - shell: bash - - args: - - fawltydeps - - ${{ inputs.options }} - runs: using: composite steps: From 9768775e99a4e7a6d9b8473579bd8ae98cac9110 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:27:44 -0400 Subject: [PATCH 03/19] Tweak more --- action.yml | 2 +- bin/install_packages | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 93149e4..2573b23 100644 --- a/action.yml +++ b/action.yml @@ -38,7 +38,7 @@ runs: shell: bash - run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" shell: bash - - id: run-isort + - id: run-fawltydeps run: > $GITHUB_ACTION_PATH/bin/run_fawltydeps ${{ inputs.options }} diff --git a/bin/install_packages b/bin/install_packages index a2404ac..e2752f8 100755 --- a/bin/install_packages +++ b/bin/install_packages @@ -1,15 +1,15 @@ #!/usr/bin/env bash -isort_version=$1 +fawltydeps_version=$1 requirements_files=$2 echo "::group::Install isort" -if [ -z "$isort_version" ] || [ "$isort_version" == "latest" ]; then - echo "Installing latest version of isort" - python3 -m pip install "isort[requirements_deprecated_finder,pipfile_deprecated_finder]" +if [ -z "$fawltydeps_version" ] || [ "$fawltydeps_version" == "latest" ]; then + echo "Installing latest version of fawltydeps" + python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]" else - echo "Installing isort==$isort_version" - python3 -m pip install "isort[requirements_deprecated_finder,pipfile_deprecated_finder]==$isort_version" + echo "Installing isort==$fawltydeps_version" + python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]==$fawltydeps_version" fi echo "::endgroup::" From 846ac8609d1418054d8dd8166f1f1fd7f8b666c5 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:31:03 -0400 Subject: [PATCH 04/19] Tweak matcher --- bin/install_packages | 4 ++-- fawltydeps-matcher.json | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/install_packages b/bin/install_packages index e2752f8..f142929 100755 --- a/bin/install_packages +++ b/bin/install_packages @@ -3,12 +3,12 @@ fawltydeps_version=$1 requirements_files=$2 -echo "::group::Install isort" +echo "::group::Install fawltydeps" if [ -z "$fawltydeps_version" ] || [ "$fawltydeps_version" == "latest" ]; then echo "Installing latest version of fawltydeps" python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]" else - echo "Installing isort==$fawltydeps_version" + echo "Installing fawltydeps==$fawltydeps_version" python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]==$fawltydeps_version" fi echo "::endgroup::" diff --git a/fawltydeps-matcher.json b/fawltydeps-matcher.json index f5b7c58..81f455c 100644 --- a/fawltydeps-matcher.json +++ b/fawltydeps-matcher.json @@ -3,10 +3,6 @@ { "owner": "fawltydeps-matcher", "pattern": [ - { - "regexp": "(These imports appear to be .* dependencies):$", - "message": 1 - }, { "regexp": "^- '([^']+)' imported at:$", "message": 1 From 5ed292c9cf2b306fda13e1c945597927c4426d99 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:33:04 -0400 Subject: [PATCH 05/19] omit matcher --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 2573b23..144e5bb 100644 --- a/action.yml +++ b/action.yml @@ -36,13 +36,13 @@ runs: ${{ inputs.fawltydeps-version }} ${{ inputs.requirements-files || inputs.requirementsFiles }} shell: bash - - run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" - shell: bash + #- run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" + #shell: bash - id: run-fawltydeps run: > $GITHUB_ACTION_PATH/bin/run_fawltydeps ${{ inputs.options }} ${{ inputs.paths }} shell: bash - - run: echo "::remove-matcher owner=fawltydeps-matcher::" - shell: bash + #- run: echo "::remove-matcher owner=fawltydeps-matcher::" + #shell: bash From b1c4267987cd98bc2807ed9bdb874c568440e016 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:35:48 -0400 Subject: [PATCH 06/19] Remove annotations from pipfile install --- bin/install_packages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install_packages b/bin/install_packages index f142929..274994f 100755 --- a/bin/install_packages +++ b/bin/install_packages @@ -6,10 +6,10 @@ requirements_files=$2 echo "::group::Install fawltydeps" if [ -z "$fawltydeps_version" ] || [ "$fawltydeps_version" == "latest" ]; then echo "Installing latest version of fawltydeps" - python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]" + python3 -m pip install "fawltydeps" else echo "Installing fawltydeps==$fawltydeps_version" - python3 -m pip install "fawltydeps[requirements_deprecated_finder,pipfile_deprecated_finder]==$fawltydeps_version" + python3 -m pip install "fawltydeps==$fawltydeps_version" fi echo "::endgroup::" From 47b35fbce1f86897121ead36ac7e5d3976f11cf1 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 16:38:31 -0400 Subject: [PATCH 07/19] try null --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 144e5bb..7ecf1e0 100644 --- a/action.yml +++ b/action.yml @@ -18,7 +18,7 @@ inputs: description: > files or directories to scan for dependency issues required: false - default: . + default: null branding: color: "purple" icon: "check-circle" From 678038e6097597fcfe937fbe75de213bbe3abd10 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:01:34 -0400 Subject: [PATCH 08/19] Nerf output --- bin/run_fawltydeps | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index 1f9fa9d..cab338f 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -1,6 +1,8 @@ #!/usr/bin/env bash echo "Running fawltydeps $*" +fawltydeps "$@" +exit $? fawltydeps_result=$(fawltydeps "$@") exit_code=$? From dde8ed218e68faa88831b7de71fbef23ed9e9dd1 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:07:09 -0400 Subject: [PATCH 09/19] redirect --- bin/run_fawltydeps | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index cab338f..734af2b 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -1,9 +1,7 @@ #!/usr/bin/env bash echo "Running fawltydeps $*" -fawltydeps "$@" -exit $? -fawltydeps_result=$(fawltydeps "$@") +fawltydeps_result=$(fawltydeps "$@" 2>&1) exit_code=$? # The fawltydeps output can be a multiline string. By default, GITHUB_OUTPUT expects From 317db567fc6f08aa0106878af8d0913b39388f4f Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:11:09 -0400 Subject: [PATCH 10/19] debug --- bin/run_fawltydeps | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index 734af2b..5665988 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -1,7 +1,7 @@ #!/usr/bin/env bash echo "Running fawltydeps $*" -fawltydeps_result=$(fawltydeps "$@" 2>&1) +fawltydeps_result=$(fawltydeps "$@") exit_code=$? # The fawltydeps output can be a multiline string. By default, GITHUB_OUTPUT expects @@ -15,4 +15,5 @@ DELIMITER=$(echo $RANDOM | md5sum | head -c 20) echo "${DELIMITER}" } >> "${GITHUB_OUTPUT}" +cat "${GITHUB_OUTPUT}" exit $exit_code From 1a2a2298fee5addc007bd8efc7af15b227359ba0 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:33:48 -0400 Subject: [PATCH 11/19] insert summary --- bin/run_fawltydeps | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index 5665988..3119f1d 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -15,5 +15,9 @@ DELIMITER=$(echo $RANDOM | md5sum | head -c 20) echo "${DELIMITER}" } >> "${GITHUB_OUTPUT}" -cat "${GITHUB_OUTPUT}" +if [[ "$exit_code" -eq 0 ]]; then + echo "OK: fawltydeps :rocket:" > "$GITHUB_STEP_SUMMARY" +else + echo "Error: fawltydeps found issues" > "$GITHUB_STEP_SUMMARY" +fi exit $exit_code From aefb79c88b48bee1ee5e2948f1d154448ef65d5c Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:41:16 -0400 Subject: [PATCH 12/19] Reinsert matcher --- action.yml | 8 ++++---- fawltydeps-matcher.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 7ecf1e0..1fa899d 100644 --- a/action.yml +++ b/action.yml @@ -36,13 +36,13 @@ runs: ${{ inputs.fawltydeps-version }} ${{ inputs.requirements-files || inputs.requirementsFiles }} shell: bash - #- run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" - #shell: bash + - run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" + shell: bash - id: run-fawltydeps run: > $GITHUB_ACTION_PATH/bin/run_fawltydeps ${{ inputs.options }} ${{ inputs.paths }} shell: bash - #- run: echo "::remove-matcher owner=fawltydeps-matcher::" - #shell: bash + - run: echo "::remove-matcher owner=fawltydeps-matcher::" + shell: bash diff --git a/fawltydeps-matcher.json b/fawltydeps-matcher.json index 81f455c..7b6f8b8 100644 --- a/fawltydeps-matcher.json +++ b/fawltydeps-matcher.json @@ -8,10 +8,10 @@ "message": 1 }, { - "regexp": "^ (.+):([0-9]+)$", + "regexp": "^ (.+):([0-9]+)$", "file": 1, "line": 2, - "loop": true + "loop": true } ] } From a5300cb2240cdefeec019bc17a0262889ea7c585 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:48:38 -0400 Subject: [PATCH 13/19] Ditch matcher, output is too irregular --- action.yml | 4 ---- bin/run_fawltydeps | 12 ++++++++++-- fawltydeps-matcher.json | 19 ------------------- 3 files changed, 10 insertions(+), 25 deletions(-) delete mode 100644 fawltydeps-matcher.json diff --git a/action.yml b/action.yml index 1fa899d..717f38b 100644 --- a/action.yml +++ b/action.yml @@ -36,13 +36,9 @@ runs: ${{ inputs.fawltydeps-version }} ${{ inputs.requirements-files || inputs.requirementsFiles }} shell: bash - - run: echo "::add-matcher::$GITHUB_ACTION_PATH/fawltydeps-matcher.json" - shell: bash - id: run-fawltydeps run: > $GITHUB_ACTION_PATH/bin/run_fawltydeps ${{ inputs.options }} ${{ inputs.paths }} shell: bash - - run: echo "::remove-matcher owner=fawltydeps-matcher::" - shell: bash diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index 3119f1d..eb59898 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -16,8 +16,16 @@ DELIMITER=$(echo $RANDOM | md5sum | head -c 20) } >> "${GITHUB_OUTPUT}" if [[ "$exit_code" -eq 0 ]]; then - echo "OK: fawltydeps :rocket:" > "$GITHUB_STEP_SUMMARY" + echo "OK: 'fawltydeps $*' :rocket:" > "$GITHUB_STEP_SUMMARY" else - echo "Error: fawltydeps found issues" > "$GITHUB_STEP_SUMMARY" + { + # shellcheck disable=SC2006 + cat < "$GITHUB_STEP_SUMMARY" fi exit $exit_code diff --git a/fawltydeps-matcher.json b/fawltydeps-matcher.json deleted file mode 100644 index 7b6f8b8..0000000 --- a/fawltydeps-matcher.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "fawltydeps-matcher", - "pattern": [ - { - "regexp": "^- '([^']+)' imported at:$", - "message": 1 - }, - { - "regexp": "^ (.+):([0-9]+)$", - "file": 1, - "line": 2, - "loop": true - } - ] - } - ] -} From 9eb6cc1f68f3cf0c57987a264e4704344c27f7e0 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:51:59 -0400 Subject: [PATCH 14/19] tweak --- bin/run_fawltydeps | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index eb59898..4fbaa3b 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -22,9 +22,8 @@ else # shellcheck disable=SC2006 cat < "$GITHUB_STEP_SUMMARY" fi From cd0a762a910472f0c31e34a1e43febabda871b8c Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 17:58:55 -0400 Subject: [PATCH 15/19] Try code block another way --- bin/run_fawltydeps | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index 4fbaa3b..ecbafa4 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -22,8 +22,9 @@ else # shellcheck disable=SC2006 cat < "$GITHUB_STEP_SUMMARY" fi From 7b777e75e3c97d47dd3703b83e726288795abbcb Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 14 May 2024 18:01:14 -0400 Subject: [PATCH 16/19] Fix up output --- bin/run_fawltydeps | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index ecbafa4..e39ad64 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -18,14 +18,13 @@ DELIMITER=$(echo $RANDOM | md5sum | head -c 20) if [[ "$exit_code" -eq 0 ]]; then echo "OK: 'fawltydeps $*' :rocket:" > "$GITHUB_STEP_SUMMARY" else - { - # shellcheck disable=SC2006 - cat < "$GITHUB_STEP_SUMMARY" \`\`\` ${fawltydeps_result} \`\`\` EOF - } > "$GITHUB_STEP_SUMMARY" -fi exit $exit_code From afa0ba37b3e7b9d45b1465f10167e17de0d8a1a9 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Thu, 23 May 2024 13:49:09 -0400 Subject: [PATCH 17/19] Tweak shell syntax --- bin/run_fawltydeps | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/bin/run_fawltydeps b/bin/run_fawltydeps index e39ad64..10a48ee 100755 --- a/bin/run_fawltydeps +++ b/bin/run_fawltydeps @@ -10,21 +10,24 @@ exit_code=$? # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings DELIMITER=$(echo $RANDOM | md5sum | head -c 20) { - echo "fawltydeps-output<<${DELIMITER}" - echo "${fawltydeps_result}" - echo "${DELIMITER}" -} >> "${GITHUB_OUTPUT}" + echo "fawltydeps-output<<$DELIMITER" + echo "$fawltydeps_result" + echo "$DELIMITER" +} >> "$GITHUB_OUTPUT" -if [[ "$exit_code" -eq 0 ]]; then - echo "OK: 'fawltydeps $*' :rocket:" > "$GITHUB_STEP_SUMMARY" -else - echo "Error: 'fawltydeps $*' found issues:" -fi -if [[ -n "${fawltydeps_result}" ]]; then - # shellcheck disable=SC2006 - cat < "$GITHUB_STEP_SUMMARY" +{ + if [[ "$exit_code" -eq 0 ]]; then + echo "OK: 'fawltydeps $*' :rocket:" + else + echo "Error: 'fawltydeps $*' found issues:" + fi + if [[ -n "${fawltydeps_result}" ]]; then + # shellcheck disable=SC2006 + cat <> "$GITHUB_STEP_SUMMARY" exit $exit_code From 35d919d37be662cc18994b30f8759fbcf3711dbd Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 5 Nov 2024 09:07:04 -0500 Subject: [PATCH 18/19] Add fawltydeps-version properly --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 717f38b..c546307 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,10 @@ inputs: ''" required: false default: "" + fawltydeps-version: + description: Version of fawltydeps to use + required: false + default: null requirements-files: description: > path(s) to requirements files that should be installed to properly From b7c8af27016668b71926da1c92de56a2ddd5c08b Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 5 Nov 2024 09:28:49 -0500 Subject: [PATCH 19/19] Bump version for release of non-Dockerized version --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d0c76b..a9dc595 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Simple usage: steps: - uses: actions/checkout@v4 - - uses: tweag/FawltyDeps-action@v0.0.3 + - uses: tweag/FawltyDeps-action@v0.1.0 More advanced example with customized command line options: @@ -56,10 +56,12 @@ More advanced example with customized command line options: - name: checkout uses: actions/checkout@v4 - name: fawltydeps lint - uses: tweag/FawltyDeps-action@v0.0.3 + uses: tweag/FawltyDeps-action@v0.1.0 with: options: --list-sources --list-imports --list-deps --detailed +Invoking FawltyDeps Using `options: --detailed` yields good results when you just want to see what problems may be present. + ## Documentation This action was inspired by and partially derived from the MIT-licensed [black](https://black.readthedocs.io/en/stable/integrations/github_actions.html) and [isort-action](https://github.com/isort/isort-action) GitHub actions.