diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml new file mode 100644 index 00000000..35d157e7 --- /dev/null +++ b/.github/workflows/comment.yaml @@ -0,0 +1,23 @@ +name: Auto Comment on PR + +on: + pull_request: + +jobs: + auto-comment: + runs-on: ubuntu-latest + steps: + - name: Check PR Changes + id: pr-changes + run: echo "::set-output name=changes::${{ toJson(github.event.pull_request.changed_files) }}" + + - name: Create Comment + if: steps.pr-changes.outputs.changes != '[]' + run: | + # Use GitHub API to create a comment on the PR + PR_NUMBER=${{ github.event.pull_request.number }} + COMMENT="# Checklist before merging\n\n- [ ] Add description to the Pull Request\n- [ ] Check the License of new pictures (non-commercial use without attribution)\n- [ ] Modify content in English\n- [ ] Modify content in German\n- [ ] Modify content in French" + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" + + curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"