-
Notifications
You must be signed in to change notification settings - Fork 50
44 lines (38 loc) · 1.2 KB
/
workitems-lock.yml
File metadata and controls
44 lines (38 loc) · 1.2 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Workitems archive lock
on:
push:
paths:
- 'workitems/**'
pull_request:
paths:
- 'workitems/**'
jobs:
check:
name: No new workitem files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Reject new files outside _archive and _templates
run: |
# On push, compare to previous commit; on PR compare to base
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE=${{ github.event.pull_request.base.sha }}
else
BASE=HEAD~1
fi
NEW=$(git diff --name-only --diff-filter=A "$BASE" HEAD \
-- 'workitems/**/*.md' \
| grep -v '^workitems/_archive/' \
| grep -v '^workitems/_templates/' \
|| true)
if [ -n "$NEW" ]; then
echo "::error::New files in workitems/ are not allowed after GitHub Issues migration."
echo "Create a GitHub Issue instead: https://github.com/rcarmo/piclaw/issues/new/choose"
echo ""
echo "Rejected files:"
echo "$NEW"
exit 1
fi
echo "No new workitem files — OK."