-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (30 loc) · 1.11 KB
/
sanity-checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Sanity Checks
on:
pull_request:
permissions:
contents: read
jobs:
verify:
name: Check whether .devcontainer.json files are updated
runs-on: ubuntu-latest
steps:
- name: Check out the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Check changed files
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
else
base="${{ github.event.before }}"
head="${{ github.event.after }}"
fi
for image in images/src/*; do
changes="$(git diff --name-only "${base}" "${head}" -- "${image}" | grep -Fv "${image}/README.md" || true)"
if [ -n "${changes}" ] && ! echo "${changes}" | grep -q "${image}/.devcontainer.json"; then
echo "::error::Changes were made to ${image}, but the corresponding .devcontainer.json was not updated"
exit 1
fi
done