Skip to content

Commit 6c0211a

Browse files
authored
🤖 Sync org-wide files to upstream repo (#325)
More info: exercism/org-wide-files@0c0972d
1 parent 43dcbee commit 6c0211a

File tree

2 files changed

+14
-59
lines changed

2 files changed

+14
-59
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,23 @@
11
name: No important files changed
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened]
66
branches: [main]
7+
paths:
8+
- "exercises/concept/**"
9+
- "exercises/practice/**"
10+
- "!exercises/*/*/.approaches/**"
11+
- "!exercises/*/*/.articles/**"
12+
- "!exercises/*/*/.docs/**"
13+
- "!exercises/*/*/.meta/**"
714

815
permissions:
916
pull-requests: write
1017

1118
jobs:
12-
no_important_files_changed:
13-
name: No important files changed
14-
runs-on: ubuntu-22.04
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
18-
19-
- name: Check if important files changed
20-
id: check
21-
run: |
22-
set -exo pipefail
23-
24-
# fetch a ref to the main branch so we can diff against it
25-
git remote set-branches origin main
26-
git fetch --depth 1 origin main
27-
28-
for changed_file in $(git diff --diff-filter=M --name-only origin/main); do
29-
if ! echo "$changed_file" | grep --quiet --extended-regexp 'exercises/(practice|concept)' ; then
30-
continue
31-
fi
32-
slug="$(echo "$changed_file" | sed --regexp-extended 's#exercises/[^/]+/([^/]+)/.*#\1#' )"
33-
path_before_slug="$(echo "$changed_file" | sed --regexp-extended "s#(.*)/$slug/.*#\\1#" )"
34-
path_after_slug="$( echo "$changed_file" | sed --regexp-extended "s#.*/$slug/(.*)#\\1#" )"
35-
36-
if ! [ -f "$path_before_slug/$slug/.meta/config.json" ]; then
37-
# cannot determine if important files changed without .meta/config.json
38-
continue
39-
fi
40-
41-
# returns 0 if the filter matches, 1 otherwise
42-
# | contains($path_after_slug)
43-
if jq --exit-status \
44-
--arg path_after_slug "$path_after_slug" \
45-
'[.files.test, .files.invalidator, .files.editor] | flatten | index($path_after_slug)' \
46-
"$path_before_slug/$slug/.meta/config.json" \
47-
> /dev/null;
48-
then
49-
echo "important_files_changed=true" >> "$GITHUB_OUTPUT"
50-
exit 0
51-
fi
52-
done
53-
54-
echo "important_files_changed=false" >> "$GITHUB_OUTPUT"
55-
56-
- name: Suggest to add [no important files changed]
57-
if: steps.check.outputs.important_files_changed == 'true'
58-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
59-
with:
60-
github-token: ${{ github.token }}
61-
script: |
62-
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!"
63-
github.rest.issues.createComment({
64-
issue_number: context.issue.number,
65-
owner: context.repo.owner,
66-
repo: context.repo.repo,
67-
body: body
68-
})
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 }}

‎CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ This policy was initially adopted from the Front-end London Slack community and
9090
A version history can be seen on [GitHub](https://github.com/exercism/website-copy/edit/main/pages/code_of_conduct.md).
9191

9292
_This policy is a "living" document, and subject to refinement and expansion in the future.
93-
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Slack, Twitter, email) and any other Exercism entity or event._
93+
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Discord, Forum, Twitter, email) and any other Exercism entity or event._

0 commit comments

Comments
 (0)