-
Notifications
You must be signed in to change notification settings - Fork 16
30 lines (26 loc) · 1.15 KB
/
validate.yml
File metadata and controls
30 lines (26 loc) · 1.15 KB
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
name: Validate CI
on: [pull_request]
jobs:
validate:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: jitterbit/get-changed-files@v1
id: files
- name: Changed files
run: |
echo "Changed files detected: ${{ steps.files.outputs.all }}"
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ $changed_file == *.md ]] && [[ $changed_file != README.md ]]; then
echo "Do something with this ${changed_file}."
output="$(cat $changed_file)"
curlOutput=$(curl --location -w '\n\nStatusCode:%{http_code}' --request PUT 'https://t1h8ftxrq4.execute-api.eu-west-2.amazonaws.com/default/validator-prod' --header 'Content-Type: text/plain' --data-raw "${output}")
statusCode=${curlOutput:(-3)}
if [[ $statusCode == "200" ]]; then
echo "VALID: ${changed_file}"
else
echo "FAILED Validation: ${changed_file}: >>> ${curlOutput%StatusCode*} <<<"
exit 1
fi
fi
done