-
Notifications
You must be signed in to change notification settings - Fork 15
46 lines (40 loc) · 1.31 KB
/
proposal-pr-check.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
38
39
40
41
42
43
44
45
46
name: OFEP Status Check
on:
pull_request:
branches:
- main
jobs:
changed_files:
runs-on: ubuntu-latest
name: Test added-OFEP proposals for status
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get added files
id: added-files
uses: tj-actions/changed-files@v37
with:
files: |
**.md
files_ignore: README.md
- name: Verify OFEP statuses
if: ${{ steps.added-files.outputs.added_files_count > 0 }}
run: |
#!/bin/bash
for file in ${{ steps.added-files.outputs.added_files }}; do
while IFS= read -r line; do
if [[ $line == "## State:"* ]]; then
value=${line#*State:}
value=${value# } # Remove leading whitespace
if [[ "$value" != "REJECTED" && "$value" != "WITHDRAWN" && "$value" != "APPROVED" ]]; then
echo "Unmatched value detected in file: $file"
echo "Detected status: $value"
echo "Please set the status to 'REJECTED', 'WITHDRAWN', or 'APPROVED' before merging."
exit 1
fi
fi
done < "$file"
done
echo "All files checked successfully."
exit 0