|
7 | 7 | paths: |
8 | 8 | - "exercises/concept/**" |
9 | 9 | - "exercises/practice/**" |
10 | | - - "!exercises/*/*/.meta/config.json" |
11 | | - - "!exercises/*/*/.meta/tests.toml" |
12 | | - - "!exercises/*/*/.docs/instructions.md" |
13 | | - - "!exercises/*/*/.docs/introduction.md" |
| 10 | + - "!exercises/*/*/.approaches/**" |
| 11 | + - "!exercises/*/*/.articles/**" |
| 12 | + - "!exercises/*/*/.docs/**" |
| 13 | + - "!exercises/*/*/.meta/**" |
14 | 14 |
|
15 | 15 | permissions: |
16 | 16 | pull-requests: write |
17 | 17 |
|
18 | 18 | jobs: |
19 | | - no_important_files_changed: |
20 | | - name: No important files changed |
21 | | - runs-on: ubuntu-22.04 |
22 | | - steps: |
23 | | - - name: Checkout code |
24 | | - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
25 | | - with: |
26 | | - repository: ${{ github.event.pull_request.head.repo.owner.login }}/${{ github.event.pull_request.head.repo.name }} |
27 | | - ref: ${{ github.head_ref }} |
28 | | - |
29 | | - - name: Check if important files changed |
30 | | - id: check |
31 | | - run: | |
32 | | - set -exo pipefail |
33 | | -
|
34 | | - git remote set-branches origin main |
35 | | - git fetch --depth 1 origin main |
36 | | -
|
37 | | - git diff --diff-filter=M --name-only origin/main |
38 | | -
|
39 | | - for changed_file in $(git diff --diff-filter=M --name-only origin/main); do |
40 | | - slug="$(echo "${changed_file}" | sed --regexp-extended 's#exercises/[^/]+/([^/]+)/.*#\1#' )" |
41 | | - path_before_slug="$(echo "${changed_file}" | sed --regexp-extended "s#(.*)/${slug}/.*#\\1#" )" |
42 | | - path_after_slug="$( echo "${changed_file}" | sed --regexp-extended "s#.*/${slug}/(.*)#\\1#" )" |
43 | | - config_json_file="${path_before_slug}/${slug}/.meta/config.json" |
44 | | -
|
45 | | - if ! [ -f "${config_json_file}" ]; then |
46 | | - # cannot determine if important files changed without .meta/config.json |
47 | | - continue |
48 | | - fi |
49 | | -
|
50 | | - changed=$(jq --arg path "${path_after_slug}" '[.files.test, .files.invalidator, .files.editor] | flatten | index($path) != null' "${config_json_file}") |
51 | | - echo "important_files_changed=${changed}" >> "$GITHUB_OUTPUT" |
52 | | - done |
53 | | -
|
54 | | - - name: Suggest to add [no important files changed] |
55 | | - if: steps.check.outputs.important_files_changed == 'true' |
56 | | - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea |
57 | | - with: |
58 | | - script: | |
59 | | - const body = "This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.\n\nIf this PR does **not** affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), **please add the following to the merge-commit message** which will stops student's tests from re-running. Please copy-paste to avoid typos.\n```\n[no important files changed]\n```\n\n For more information, refer to the [documentation](https://exercism.org/docs/building/tracks#h-avoiding-triggering-unnecessary-test-runs). If you are unsure whether to add the message or not, please ping `@exercism/maintainers-admin` in a comment. Thank you!" |
60 | | - github.rest.issues.createComment({ |
61 | | - issue_number: context.issue.number, |
62 | | - owner: context.repo.owner, |
63 | | - repo: context.repo.repo, |
64 | | - body: body |
65 | | - }) |
| 19 | + pause: |
| 20 | + uses: exercism/github-actions/.github/workflows/check-no-important-files-changed.yml@main |
| 21 | + with: |
| 22 | + repository: ${{ github.event.pull_request.head.repo.owner.login }}/${{ github.event.pull_request.head.repo.name }} |
| 23 | + ref: ${{ github.head_ref }} |
0 commit comments