From 35d36b20b290034e0aebf4fb413e810e3c140157 Mon Sep 17 00:00:00 2001 From: Pascal Frenz <5677521+PascalFrenz@users.noreply.github.com> Date: Sun, 19 May 2024 09:04:54 +0200 Subject: [PATCH] fix: only comment welcome message on non-bot user PRs (#24) Currently, the welcome message is commented to every PR, even ones that were opened by renovate. The message itself does not make sense on PRs opened by bots and this PR fixes that behavior. It also fixes a link at the end of the message to the location of the workflow file that generated the message. --- .github/workflows/default_welcome_message_callable.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/default_welcome_message_callable.yml b/.github/workflows/default_welcome_message_callable.yml index 95936c6..b55e8d1 100644 --- a/.github/workflows/default_welcome_message_callable.yml +++ b/.github/workflows/default_welcome_message_callable.yml @@ -14,6 +14,7 @@ on: jobs: welcome-message: + if: ${{ ! endsWith(github.actor, '[bot]') }} runs-on: ubuntu-latest permissions: pull-requests: write @@ -27,6 +28,6 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'Hey @${{ github.event.pull_request.user.login }}! 👋\n\nThank you for your contribution to the project. Please refer to the [contribution rules](../blob/main/.github/CONTRIBUTING.md) for a quick overview of the process.\n\nMake sure that this PR clearly explains:\n\n- the problem being solved\n- the best way a reviewer and you can test your changes\n\nWith submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this [LICENSE](../blob/main/LICENSE).\n\nThe following ChatOps commands are supported:\n- `/help`: notifies a maintainer to help you out\n\nSimply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.\n\n_This message was generated automatically. You are welcome to [improve it](https://github.com/Hapag-Lloyd/test/blob/main/.github/workflows/default_welcome_message_callable.yml)._' + body: 'Hey @${{ github.event.pull_request.user.login }}! 👋\n\nThank you for your contribution to the project. Please refer to the [contribution rules](../blob/main/.github/CONTRIBUTING.md) for a quick overview of the process.\n\nMake sure that this PR clearly explains:\n\n- the problem being solved\n- the best way a reviewer and you can test your changes\n\nWith submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this [LICENSE](../blob/main/LICENSE).\n\nThe following ChatOps commands are supported:\n- `/help`: notifies a maintainer to help you out\n\nSimply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.\n\n_This message was generated automatically. You are welcome to [improve it](https://github.com/Hapag-Lloyd/Workflow-Templates/blob/main/.github/workflows/default_welcome_message_callable.yml)._' }) # yamllint enable rule:line-length