File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check TODOs and FIXMEs in Changed Files
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - master
7+ - ' rel/*'
8+ - " rc/*"
9+ paths-ignore :
10+ - ' docs/**'
11+ - ' site/**'
12+ # allow manually run the action:
13+ workflow_dispatch :
14+
15+ jobs :
16+ todo-check :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout code
21+ uses : actions/checkout@v4
22+
23+ - name : Check for TODOs and FIXMEs in changed files
24+ run : |
25+ # Fetch the target branch
26+ git fetch origin $GITHUB_BASE_REF
27+
28+ # Check if there is a common ancestor
29+ if git merge-base --is-ancestor origin/$GITHUB_BASE_REF HEAD; then
30+ # Get the diff of the changes
31+ DIFF=$(git diff origin/$GITHUB_BASE_REF...HEAD)
32+ else
33+ # If no common ancestor, compare with the initial commit
34+ DIFF=$(git diff $(git hash-object -t tree /dev/null) HEAD)
35+ fi
36+
37+ # Check the diff for TODOs
38+ if echo "$DIFF" | grep -Eq '^\+.*(TODO|FIXME)'; then
39+ echo "TODO found in the changes. Please resolve it before merging."
40+ exit 1
41+ else
42+ echo "No TODOs found in changed content."
43+ fi
You can’t perform that action at this time.
0 commit comments