Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge plugin supports checking the PR content after /merge command #857

Open
1 task done
Mini256 opened this issue Dec 31, 2021 · 2 comments
Open
1 task done

Merge plugin supports checking the PR content after /merge command #857

Mini256 opened this issue Dec 31, 2021 · 2 comments
Labels
lifecycle/rotten type/feature Categorizes issue or PR as related to a new feature.

Comments

@Mini256
Copy link
Member

Mini256 commented Dec 31, 2021

Feature Request

  • I have searched the issues of this repository and believe that this is not a duplicate.

Is your feature request related to a Issue or PR(Optional)

Describe the feature you'd like:

In the current merge plugin, when the config item store_tree_hash is enabled, the merge plugin will temporarily save the last commit SHA value while the /merge command triggers. When there is a new commit be submitted, the plugin checks whether the last commit (except the commit of merge-base) SHA changes. If changed, the robot will remove the status/can-merge label on pull request.

In some cases, we want to ensure that some contents in PR other than code will not change during the process from /merge to PR being merged. If changed, PR should be canceled merging.

Do you have any ideas on how to implement it? (Optional)

  1. Add store_verify_payload_hash and verify_payload_template options
  2. In the verify_payload_template option, we can use the syntax of Go Template to define what we need to verify, for example:
ti-community-merge:
  - repos:
      - tikv/tikv
      - tikv/pd
    store_tree_hash: true
    store_verify_payload_hash: true
    verify_payload_template: |
       {{- .ExtractContent "(?im)^Issue Number:(?P<content>.+)" .Body -}}
       {{- .ExtractContent "(?i)\x60\x60\x60commit-message(?P<content>[\\w|\\W]+)\x60\x60\x60" .Body -}}
  1. When the /merge command trigger, the merge plugin will extract the content according to the verify_payload_template option as payload, then get the SHA value of payload and temporarily store it.
  2. When the PR occurs edited event, if the bot found that the payload SHA has changed, it will remove the status/can-merge label from PR.
@Mini256 Mini256 added the type/feature Categorizes issue or PR as related to a new feature. label Dec 31, 2021
@ti-chi-bot
Copy link
Member

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-community-infra or Mini256.
/lifecycle stale

@ti-chi-bot
Copy link
Member

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-community-infra or Mini256.
/lifecycle rotten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten type/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants