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

convert comment based action to be label based #834

Open
MylesBorins opened this issue Aug 11, 2020 · 10 comments
Open

convert comment based action to be label based #834

MylesBorins opened this issue Aug 11, 2020 · 10 comments
Labels

Comments

@MylesBorins
Copy link
Member

@MylesBorins MylesBorins commented Aug 11, 2020

The amazing @mmarchini made an action for nodejs/node that using labels to kick off CI

https://github.com/nodejs/node/blob/master/.github/workflows/auto-start-ci.yml

I think we should convert the existing comment based trigger to trigger based on a label. I believe that the above yml and the existing staging action have everything needed to accomplish this... we should not have to update any credentials (although we should update docs).

One thing... this might not be able to be previewed in a PR... so there might be some fancy fork work needed, or alternatively land and prod to see if it works.

@mmarchini
Copy link
Member

@mmarchini mmarchini commented Aug 11, 2020

In theory changing the event to pull_request_target: [labeled], adding if: github.event.label.name == 'start-ci' to the job and changing every use of github.event.issue.number with github.event.number should be enough for this use case, with the caveat that existing PRs need to be rebased for the action to trigger (because of nodejs/node#34707 (comment)). If that caveat doesn't work for this repo, the schedule approach we use on core also works, but requires more changes (happy to help anyone who wants to work on it).

@nschonni
Copy link
Member

@nschonni nschonni commented Aug 11, 2020

Makes sense to me. I think that if the preview is successful, it could also remove the label.

The instructions in https://github.com/nodejs/nodejs.dev/blame/695b54d12f249028b6120a2e7734fa6729e1e6b9/.github/PULL_REQUEST_TEMPLATE.md#L18 will also need to update if this is switched

@MylesBorins
Copy link
Member Author

@MylesBorins MylesBorins commented Aug 11, 2020

The job I referenced on core removes the label as soon as it is kicked off. I think there is an additional label added if it fails I would imagine that pattern would be worth following

@benhalverson
Copy link
Contributor

@benhalverson benhalverson commented Aug 11, 2020

If we switch to labels does that mean only members can start the ci and create a preview link?

@mmarchini
Copy link
Member

@mmarchini mmarchini commented Aug 11, 2020

Yes

@MylesBorins
Copy link
Member Author

@MylesBorins MylesBorins commented Aug 12, 2020

but folks with a triage role could kick it off as well

@JasonEtco
Copy link
Member

@JasonEtco JasonEtco commented Aug 12, 2020

Could be worth updating the PR template with a checkbox like this, if only so that triagers/maintainers know without having to specifically be asked:

  • This should be preview deployed

As a bonus, the action could also auto-add the label if that is checked - though it wouldn't trigger the next workflow (because Actions can't trigger Actions), but we could add it to the same pull_request.opened workflow.

@mmarchini
Copy link
Member

@mmarchini mmarchini commented Aug 12, 2020

though it wouldn't trigger the next workflow (because Actions can't trigger Actions)

It works if you use a personal token (we can create one for @nodejs-github-bot and add it to the repo)

@nschonni
Copy link
Member

@nschonni nschonni commented Aug 13, 2020

Took a try with #851

@nschonni
Copy link
Member

@nschonni nschonni commented Aug 13, 2020

Potentially, the label could be added to PULL_REQUEST_TEMPLATE frontmatter if a preview is wanted on all PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.