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/8] 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 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\"}" 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/8] 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 35d157e7..bfae0ad0 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` + }) From 08a56a4e716b0984dfa5f0fc595b559004c2ea18 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:10:19 +0200 Subject: [PATCH 3/8] fix: specify pull request event types for auto comment workflow Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index bfae0ad0..6f8bcab1 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -1,5 +1,7 @@ name: auto comment -on: [pull_request] +on: + pull_request: + types: [opened] jobs: comment: runs-on: ubuntu-latest From ceb7d683118efd768f67fa7faffa7b886dd19b2e Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:12:26 +0200 Subject: [PATCH 4/8] fix: update pull request event types to trigger on main branch Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 6f8bcab1..86c17dda 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -1,7 +1,7 @@ name: auto comment on: pull_request: - types: [opened] + branches: [main] jobs: comment: runs-on: ubuntu-latest From d4983ba71f3d5cc96c3a13d117fdcec2d90b36ab Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:15:22 +0200 Subject: [PATCH 5/8] fix: ensure pull request event type 'opened' is specified for auto comment workflow Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 86c17dda..1f4a1c6d 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -1,6 +1,7 @@ name: auto comment on: pull_request: + types: [opened] branches: [main] jobs: comment: From ecea75e0c3df3f936aa32c19796fb014bda5c811 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:18:38 +0200 Subject: [PATCH 6/8] fix: update Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 1f4a1c6d..3e796c46 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -15,7 +15,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `👋 @${{ context.payload.pull_request.user.login }} + body: `👋 @{{ author }} Thank you for raising your pull request. # Checklist before merging From 2bca765826333ec67b944a939213726c3dd0b380 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:27:50 +0200 Subject: [PATCH 7/8] fix: update auto comment workflow to include permissions and simplify message Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 3e796c46..ba4abeb3 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -6,6 +6,8 @@ on: jobs: comment: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - uses: actions/github-script@v7 with: @@ -15,8 +17,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `👋 @{{ author }} - Thank you for raising your pull request. + body: `Thank you for raising your pull request. # Checklist before merging From 95d1e764aa20405c472feb2ec009bae16e148d58 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:37:08 +0200 Subject: [PATCH 8/8] fix: enhance auto comment message for pull requests and improve checklist formatting Signed-off-by: lennartrommeiss <61516567+lenderom@users.noreply.github.com> --- .github/workflows/comment.yaml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index ba4abeb3..d47043b8 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -17,13 +17,16 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `Thank you for raising your pull request. + body: `Hi there! 👋 - # Checklist before merging + Thank you for your contribution to the FIP Guide! 🚀 + We appreciate your effort in making rail staff travel information more accessible. 🚄 - - [ ] 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` + ## Checklist before merging: + + - [ ] Added a description to the Pull Request + - [ ] Checked the License of new pictures (non-commercial use without attribution) + - [ ] Modified content in English + - [ ] Modified content in German + - [ ] Modified content in French` })