cirrus-actions / rebase

GitHub Action to automatically rebase PRs
MIT License
686 stars 138 forks source link

Suggestion: Trigger rebase using labels #53

Open matthijskooijman opened 4 years ago

matthijskooijman commented 4 years ago

To reduce the noise on a PR from a /rebase comment, it might be interesting to let the rebase be triggered by a label. E.g.:

I suspect that this might not actually need any changes to the action itself, just a different workflow configuration (this would require a way to remove a label, but it seems there is an action for that, or it could be done using github-script).

Anyone tried this already?

fkorotkov commented 4 years ago

I think in theory this should work:

on: 
  issue:
    types: [labeled]
name: Automatic Rebase
jobs:
  rebase:
    name: Rebase
    if: github.event.issue.pull_request != '' && github.event.label == 'needs_rebase'
    # the rest is the same
Paulomart commented 4 years ago

Did some tests using labels: https://github.com/Paulomart/rebase-test/pull/2 The actions runs when the label is set and removes it when the action is run.

Problem here is that, the pull_request event is not trigged when the pr has conflicts.

matthijskooijman commented 4 years ago

Problem here is that, the pull_request event is not trigged when the pr has conflicts.

Hm, that sounds weird. Is that documented? Or is this a bug in GH?

Paulomart commented 4 years ago

Yeah there is an answer in the support forum https://github.community/t/run-actions-on-pull-requests-with-merge-conflicts/17104/2

matthijskooijman commented 4 years ago

Might be good to send in feedback to GH as suggested in the last post, in case nobody did so already (and otherwise to give the issue a bit more priority). Also, consider tracking your feedback at https://github.com/isaacs/github/issues