Skip to content

add debug echo for changed files in PR comment workflow #4064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions .github/workflows/pr-comments.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PR Comments

on:
pull_request_target:
pull_request:
branches:
- master

Expand Down Expand Up @@ -65,25 +65,27 @@ jobs:
remove-link-from-badge: true
default-branch: master

python-ut-files-comment:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
# python-ut-files-comment:
# runs-on: ubuntu-22.04
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

- name: Check and comment if no unit test files modified
run: |
git fetch origin master
changed_files=$(git diff --name-only origin/master)
# - name: Check and comment if no unit test files modified
# run: |
# git fetch origin master
# echo "changed_files"
# changed_files=$(git diff --name-only origin/master)
# changed_files=$(git diff --name-only origin/master)

if echo "$changed_files" | grep -qE '(^test|_test\.py|^tests|_tests\.py|.test)'; then
echo "✅ Unit test files were modified."
else
echo "⚠️ No unit test files modified."
# if echo "$changed_files" | grep -qE '(^test|_test\.py|^tests|_tests\.py|.test)'; then
# echo "✅ Unit test files were modified."
# else
# echo "⚠️ No unit test files modified."

curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"body":"⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
fi
# curl -X POST \
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
# -H "Accept: application/vnd.github.v3+json" \
# -d '{"body":"⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️"}' \
# "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
# fi