From 1a35133527b2622529315df9873af3dc098a7a1e Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Tue, 13 Feb 2024 21:33:33 -0500 Subject: [PATCH] Add input for setting detect-secrets version (#58) * Add env support for detect-secrets version * Add detect_secrets_version input * Update CI with test for explicit version * Add env for docker container --- .github/workflows/reviewdog.yml | 12 ++++++++++++ Dockerfile | 9 +++++++-- action.yml | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 7e577f2..c49585c 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -15,3 +15,15 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review workdir: testdata + + detect-secrets-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: detect-secrets + uses: ./ + with: + detect_secrets_version: "1.3.0" + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + workdir: testdata diff --git a/Dockerfile b/Dockerfile index ea6dcaa..52554b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,13 @@ RUN set -eux \ && apt-get install -y --no-install-recommends \ git \ wget \ - && wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION} \ - && pip install detect-secrets[word_list] + && wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION} + +RUN if [ -n "$INPUT_DETECT_SECRETS_VERSION" ]; then \ + pip install detect-secrets[word_list]=="$INPUT_DETECT_SECRETS_VERSION"; \ + else \ + pip install detect-secrets[word_list]; \ + fi COPY baseline2rdf.py /usr/local/bin/baseline2rdf COPY entrypoint.sh /entrypoint.sh diff --git a/action.yml b/action.yml index 120d5a3..ddb6d76 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,9 @@ inputs: detect_secrets_flags: description: Flags and args of detect-secrets command. The default is '--all-files --force-use-all-plugins'. default: --all-files --force-use-all-plugins + detect_secrets_version: + description: The detect-secrets version to install. By default will install the latest version. + default: "" baseline_path: description: The baseline path to update. If not provided, a new baseline will be created. default: "" @@ -43,6 +46,8 @@ inputs: runs: using: docker image: Dockerfile + env: + INPUT_DETECT_SECRETS_VERSION: ${{ inputs.detect_secrets_version }} branding: icon: shield color: green