Skip to content

Commit

Permalink
check if comment exists before deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
freitasmillena committed Aug 11, 2023
1 parent d3bb64c commit 2961088
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/check-apache-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ jobs:
- name: Check for Apache License
run: |
echo "$BODY" | grep -iPq "^I submit this contribution under the Apache-2.0 license.$" || echo "CHECK_FAILED=true" >> $GITHUB_ENV
- name: Delete comment if license is fixed
- name: Check for comment tag
if: env.CHECK_FAILED != 'true'
run: |
comments=$(curl -s -H "Authorization: token ${{ secrets.KICS_BOT_PAT }}" \
-X GET "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
if echo "$comments" | grep -q "apache_license"; then
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Delete comment if license is fixed
if: env.TAG_EXISTS == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Expand Down

0 comments on commit 2961088

Please sign in to comment.