From ce809fc72b4baeea7c0eb364b31235e878278b7e Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:20:46 +0530 Subject: [PATCH] feat: add comment in events --- ...d-ready-to-merge-or-do-not-merge-label.yml | 2 +- .github/workflows/autoupdate-pr-branches.yml | 26 ++++++++++++------- .github/workflows/help-command.yml | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml index 66606fc1..92c5d30a 100644 --- a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +++ b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml @@ -59,7 +59,7 @@ jobs: body: `Hello, @${{ github.actor }}! 👋🏼 This PR is not up to date with the base branch and can't be merged. Please update your branch manually with the latest version of the base branch. - PRO-TIP: Add a comment to your PR with the text: \`/au\` or \`/autoupdate\` and our bot will take care of updating the branch in the future. The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. + PRO-TIP: Add a comment to your PR with the text: \`/u\` or \`/update\` and our bot will take care of updating the branch in the future. The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. Thanks 😄` }) } diff --git a/.github/workflows/autoupdate-pr-branches.yml b/.github/workflows/autoupdate-pr-branches.yml index 7d98471b..aba56e2d 100644 --- a/.github/workflows/autoupdate-pr-branches.yml +++ b/.github/workflows/autoupdate-pr-branches.yml @@ -17,9 +17,24 @@ on: - 'bot/**' - 'all-contributors/**' + issue_comment: + types: [created] + jobs: autoupdate-fork: - if: startsWith(github.repository, 'asyncapi/') + if: > + startsWith(github.repository, 'asyncapi/') && + ( + github.event_name == 'push' || + ( + github.event_name == 'issue_comment' && + github.event.issue.pull_request != null && + ( + contains(github.event.comment.body, '/update') || + contains(github.event.comment.body, '/u') + ) + ) + ) runs-on: ubuntu-latest steps: - name: Autoupdate PR branches @@ -29,11 +44,4 @@ jobs: pr_filter: 'labelled' pr_label: 'autoupdate' merge_fail_action: 'comment' - ignore_conflicts: true - - - - - - - \ No newline at end of file + ignore_conflicts: true \ No newline at end of file diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index d4ba4a44..c68db841 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -34,6 +34,7 @@ jobs: - \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added - \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added - \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.` + - \`/update\` or \`/u\` - This comment will update the PR with the latest changes from the target branch. Unless there is a merge conflict or it is a draft PR.` }) create_help_comment_issue: