From 0446f63b406c5c5813407d81cda3f77041adc379 Mon Sep 17 00:00:00 2001 From: Matthias Kay Date: Mon, 6 Jan 2025 14:15:03 +0100 Subject: [PATCH] test --- ...fault_slash_ops_command_ready_callable.yml | 3 +- .../default_welcome_message_callable.yml | 2 - .github/workflows/this_spelling.yml | 42 +++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/default_slash_ops_command_ready_callable.yml b/.github/workflows/default_slash_ops_command_ready_callable.yml index 3dac187..0d3caf0 100644 --- a/.github/workflows/default_slash_ops_command_ready_callable.yml +++ b/.github/workflows/default_slash_ops_command_ready_callable.yml @@ -32,7 +32,8 @@ jobs: }); // remove the checklist paragraph from "# Checklist" to the end of the PR text - const prTextWithoutChecklist = prText.split('\n').slice(0, prText.split('\n').findIndex(line => line.startsWith('# Checklist'))).join('\n'); + const prTextWithoutChecklist = prText.split('\n').slice(0, prText.split('\n'). + findIndex(line => line.startsWith('# Checklist'))).join('\n'); github.rest.issues.update({ owner: context.repo.owner, diff --git a/.github/workflows/default_welcome_message_callable.yml b/.github/workflows/default_welcome_message_callable.yml index c205d45..e6b52e7 100644 --- a/.github/workflows/default_welcome_message_callable.yml +++ b/.github/workflows/default_welcome_message_callable.yml @@ -21,7 +21,6 @@ jobs: steps: - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: - # yamllint disable rule:line-length script: | message = `Hey @${{ github.event.pull_request.user.login }}! 👋 @@ -55,4 +54,3 @@ jobs: 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/Workflow-Templates/blob/main/.github/workflows/default_welcome_message_callable.yml)._' }) - # yamllint enable rule:line-length diff --git a/.github/workflows/this_spelling.yml b/.github/workflows/this_spelling.yml index 10865e3..df94e6d 100644 --- a/.github/workflows/this_spelling.yml +++ b/.github/workflows/this_spelling.yml @@ -9,3 +9,45 @@ jobs: default: uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_spelling_callable.yml@main secrets: inherit + + welcome-message: + if: ${{ ! endsWith(github.actor, '[bot]') }} + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + message = `Hey @${{ github.event.pull_request.user.login }}! 👋 + + Thank 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. + + Make sure that this PR clearly explains: + + - the problem being solved + - the best way a reviewer and you can test your changes + + With 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). + + The following ChatOps commands are supported: + - `/help`: notifies a maintainer to help you out + - `/ready`: marks the PR as ready for review and removes the checklist + + Simply 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. + + _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)._` + + // dedent the message + message = message.replace(/^ +/gm, '') + + // adds a comment to the PR (there is the issue API only which works work PRs too) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: message, + })