diff --git a/.github/workflows/no-important-files-changed.yml b/.github/workflows/no-important-files-changed.yml index 82f609155..3fecd63ad 100644 --- a/.github/workflows/no-important-files-changed.yml +++ b/.github/workflows/no-important-files-changed.yml @@ -1,7 +1,7 @@ name: No important files changed on: - pull_request_target: + pull_request: types: [opened] paths: - "exercises/*/*/tests/**" @@ -22,7 +22,11 @@ jobs: env: TARGET_BRANCH: ${{ github.base_ref }} run: | - for changed_file in $(git diff --name-only $TARGET_BRANCH); do + # fetch a ref to the target branch so we can diff against it + # git remote set-branches origin '*' + # git fetch --depth 1 origin $TARGET_BRANCH + + for changed_file in $(git diff --name-only origin/$TARGET_BRANCH); do if ! echo "$changed_file" | grep --quiet --extended-regexp 'exercises/(practice|concept)' ; then continue fi @@ -55,7 +59,7 @@ jobs: uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: script: | - const body = "This PR touches files which probably affect the outcome of the tests of an exercise. If this is not the case, please add the following to the merge commit message. Copy-paste to avoid typos. This will prevent tests from rerunning unnecessarily. For more information, refer to the [documentation](https://exercism.org/docs/building/tracks#h-avoiding-triggering-unnecessary-test-runs).\n```\n[no important files changed]\n```" + const body = "This PR touches files which probably affect the outcome of the tests of an exercise. If this is not the case, please add the following to the merge-commit message. Copy-paste to avoid typos. This will prevent tests from rerunning unnecessarily. For more information, refer to the [documentation](https://exercism.org/docs/building/tracks#h-avoiding-triggering-unnecessary-test-runs).\n```\n[no important files changed]\n```" github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner,