From 9927ec94c7f4c3a44690677b2cd681a9955d4e91 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 18:59:52 +0200 Subject: [PATCH 1/2] fix: add comment workflow Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/comment.yaml diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml new file mode 100644 index 000000000..35d157e73 --- /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\"}" From a07e4519c632748dff7b34bb4c84abf0b4e5774f Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:08:26 +0200 Subject: [PATCH 2/2] fix: next try Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 35d157e73..bfae0ad0d 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -1,23 +1,25 @@ -name: Auto Comment on PR - -on: - pull_request: - +name: auto comment +on: [pull_request] jobs: - auto-comment: + 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) }}" + - uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `👋 @${{ context.payload.pull_request.user.login }} + Thank you for raising your pull request. - - 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" + # Checklist before merging - curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" + - [ ] Add description to the Pull Request + - [ ] Check the License of new pictures (non-commercial use without attribution) + - [ ] Modify content in English + - [ ] Modify content in German + - [ ] Modify content in French` + })