diff --git a/action.cjs b/action.cjs index 76681205..4579490f 100644 --- a/action.cjs +++ b/action.cjs @@ -5,6 +5,26 @@ function hashFiles (filename) { } module.exports = async ({ github, context, inputs, steps, actionPath, core }) => { + // run-reviewdog-pr step + if (steps['reviewdog-enabled-pr'].outputs.result === 'true') { + const { execSync } = require('child_process') + const env = { + ...process.env, + ASSIGNEES: inputs.assignees, + REVIEWDOG_GITHUB_API_TOKEN: inputs.github_token, + SEC_ACTION_DEBUG: inputs.debug, + PYPI_INDEX_URL: inputs.pip_audit_pypi_index_url, + PYPI_INSECURE_HOSTS: inputs.pip_audit_pypi_insecure_hosts + } + execSync(`${github.action_path}/assets/reviewdog.sh`, { env }) + } + // run-reviewdog-full step + if (steps['reviewdog-enabled-full'].outputs.result === 'true') { + const { execSync } = require('child_process') + const env = { ...process.env } + delete env.GITHUB_BASE_REF + execSync(`${actionPath}/assets/reviewdog.sh`, { env }) + } // comments-after step let commentsAfter = null if (steps['reviewdog-enabled-pr'].outputs.result === 'true') { diff --git a/action.yml b/action.yml index ad0fe2f6..ff692987 100644 --- a/action.yml +++ b/action.yml @@ -194,31 +194,6 @@ runs: script: | const { execSync } = require('child_process') execSync('${{ github.action_path }}/assets/debug.sh') - # REVIEWDOG Run - - if: ${{ steps.reviewdog-enabled-pr.outputs.result == 'true' }} - name: Run reviewdog - id: run-reviewdog-pr - env: - ASSIGNEES: ${{inputs.assignees}} - REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.github_token }} - SEC_ACTION_DEBUG: ${{ inputs.debug }} - PYPI_INDEX_URL: ${{ inputs.pip_audit_pypi_index_url }} - PYPI_INSECURE_HOSTS: ${{ inputs.pip_audit_pypi_insecure_hosts }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - const { execSync } = require('child_process') - execSync('${{ github.action_path }}/assets/reviewdog.sh') - - if: ${{ steps.reviewdog-enabled-full.outputs.result == 'true' }} - name: Run reviewdog full - id: run-reviewdog-full - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - const { execSync } = require('child_process') - const env = { ...process.env } - delete env['GITHUB_BASE_REF'] - execSync('${{ github.action_path }}/assets/reviewdog.sh', { env }) - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: |