-
-
Notifications
You must be signed in to change notification settings - Fork 501
37 lines (32 loc) · 1.05 KB
/
tutorial-pull-requests.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
35
36
37
name: Tutorial Pull Requests
on:
pull_request:
paths:
- guides/release/tutorial/**/*.md
jobs:
do-no-edit:
name: Do Not Edit Generated Files
runs-on: ubuntu-latest
if: github.event.pull_request.head.ref != 'super-rentals-tutorial'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: git fetch origin "${BASE_REF}"
- name: Annotate
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
STATUS="0"
for FILE in $(git diff --name-only "${BASE_SHA}"); do
LINE=$(sed -n "\|<\!-- Heads up\!|=" "${FILE}")
if [[ ! -z "$LINE" ]]; then
STATUS="1"
echo "::error file=${FILE},line=${LINE}::This is a generated file, do not edit directly. Follow the URL above to edit the source file instead."
fi
done
exit "${STATUS}"