blob: 46b4f0ad5af95ddf7dbdc4a0c18c592175be765e [file] [log] [blame]
name: Check TODOs and FIXMEs in Changed Files
on:
pull_request:
branches:
- master
- 'dev/*'
- 'rel/*'
- "rc/*"
- 'force_ci/**'
paths-ignore:
- 'docs/**'
- 'site/**'
# allow manually run the action:
workflow_dispatch:
jobs:
todo-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for TODOs and FIXMEs in changed files
run: |
# Fetch the target branch
git fetch origin $GITHUB_BASE_REF
git switch -c check_branch
# Get the diff of the changes
echo Get the diff of the changes
DIFF=$(git diff origin/$GITHUB_BASE_REF check_branch -- . ':(exclude).github/workflows/todos-check.yml')
if [ -z "$DIFF" ]; then
echo "No changes detected."
exit 0
fi
# Check the diff for TODOs
echo "$DIFF" | grep -E '^\+.*(TODO|FIXME)' > check.log
if [ $(wc -l < check.log> -eq 0)]; then
echo "No TODOs or FIXMEs found in changed content."
else
echo "TODO or FIXME found in the changes. Please resolve it before merging."
cat check.log
exit 1
fi