Skip to content

Commit

Permalink
fix: show file name
Browse files Browse the repository at this point in the history
Signed-off-by: yuda <[email protected]>
  • Loading branch information
yuda110 committed Dec 3, 2024
1 parent 33c5037 commit 08c48e9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/pull_request_code_warning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,31 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Check for TODO and console.log
- name: Check for TODOs
run: |
# Find TODOs
TODO_COUNT=$(grep -rnw . -e "TODO" --exclude-dir={node_modules,.git} | wc -l)
if [ $TODO_COUNT -gt 0 ]; then
echo "WARNING: Found $TODO_COUNT TODOs in the code."
echo "Checking for TODOs..."
grep -rl "TODO" . --exclude-dir={node_modules,.git} > todo_files.txt || true
if [ -s todo_files.txt ]; then
echo "The following files contain TODOs:"
cat todo_files.txt
while IFS= read -r file; do
echo "::warning file=$file::File contains TODO"
done < todo_files.txt
else
echo "No TODOs found."
fi
# Find console.log
LOG_COUNT=$(grep -rnw . -e "console.log" --exclude-dir={node_modules,.git} | wc -l)
if [ $LOG_COUNT -gt 0 ]; then
echo "WARNING: Found $LOG_COUNT occurrences of console.log in the code."
fi
if [ $TODO_COUNT -gt 0 ] || [ $LOG_COUNT -gt 0 ]; then
exit 1
- name: Check for console.log
run: |
echo "Checking for console.log..."
grep -rl "console.log" . --exclude-dir={node_modules,.git} > console_log_files.txt || true
if [ -s console_log_files.txt ]; then
echo "The following files contain console.log:"
cat console_log_files.txt
while IFS= read -r file; do
echo "::warning file=$file::File contains console.log"
done < console_log_files.txt
else
echo "No console.log found."
fi
13 changes: 0 additions & 13 deletions .github/workflows/pull_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ jobs:
with:
submodules: true

- name: Comment on Pull Request with TODO files
if: always()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `test!!!`,
});
- name: Setup Node.js
uses: actions/setup-node@v3
with:
Expand Down

0 comments on commit 08c48e9

Please sign in to comment.