diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d3a510d..05da5ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,20 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-check level: info + test-pr-change-check: + if: github.event_name == 'pull_request' + name: runner / languagetool (github-pr-check) (Changed) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: ./ + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-check + level: info + base_ref: develop test-pr-review: if: github.event_name == 'pull_request' @@ -40,4 +54,4 @@ jobs: reporter: github-pr-review level: info patterns: "**.md" - custom_api_endpoint: https://languagetool.org/api + custom_api_endpoint: https://languagetool.org/api \ No newline at end of file diff --git a/action.yml b/action.yml index 0339dd4..6b3113e 100644 --- a/action.yml +++ b/action.yml @@ -37,6 +37,9 @@ inputs: custom_api_endpoint: description: 'Custom API endpoint of LanguageTool server. e.g. https://languagetool.org/api' default: '' + base_ref: + description: 'The branch or commit reference that files changed or added should be collected from. Will use the default branch if coming from a pull request if not set.' + default: '' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 0676333..a30201d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -36,7 +36,11 @@ fi # Disable glob to handle glob patterns with ghglob command instead of with shell. set -o noglob -FILES="$(git ls-files | ghglob ${INPUT_PATTERNS})" +if [ -n "${INPUT_BASE_REF}" ]; then + FILES="$(git diff "origin/${INPUT_BASE_REF}" --name-only | ghglob "${INPUT_PATTERNS}")" +else + FILES="$(git ls-files | ghglob "${INPUT_PATTERNS}")" +fi set +o noglob # To manage whitespaces in filepath