openmodelingfoundation.github.io icon indicating copy to clipboard operation
openmodelingfoundation.github.io copied to clipboard

consider using GitHub actions to automatically label PRs

Open alee opened this issue 5 years ago • 23 comments

https://github.com/actions/labeler

UPDATE: please consider upvoting https://github.community/t5/GitHub-Actions/GitHub-actions-are-severely-limited-on-PRs/m-p/54669# to improve awareness of this issue to the GitHub team. Having a GitHub action be able to automatically label a PR based on its context would be pretty helpful!

alee avatar May 11 '20 16:05 alee

Outstanding!!!

cmbarton avatar May 11 '20 17:05 cmbarton

unfortunately it appears this only works on pull requests that originate from this repository, not forks:

Note that only pull requests being opened from the same repository can be labeled. This action will not currently work for pull requests from forks -- like is common in open source projects -- because the token for forked pull request workflows does not have write permissions.

alee avatar May 11 '20 17:05 alee

So we'll probably need to create PR templates like @cpritcha did for issues following a similar pattern:

https://help.github.com/en/github/building-a-strong-community/creating-a-pull-request-template-for-your-repository

using query parameters to the label the PR appropriately:

https://help.github.com/en/github/managing-your-work-on-github/about-automation-for-issues-and-pull-requests-with-query-parameters

alee avatar May 11 '20 17:05 alee

Is this something we can do this week? Or do we need to give out labeling permissions to participants and do it manually?

cmbarton avatar May 11 '20 17:05 cmbarton

We should be able to get it done this week but we need to test out the PR templates. @cpritcha and @chrstngyn and I are discussing at the moment

alee avatar May 11 '20 17:05 alee

Multiple PR templates aren't easily possible to take advantage of because we can't pass through the needed template information to the edit URL. You can only pass the template information if you're on a branch comparison page like https://github.com/openmodelingfoundation/openmodelingfoundation.github.io/compare/develop...interop-edits (so https://github.com/openmodelingfoundation/openmodelingfoundation.github.io/compare/develop...interop-edits?template=accessibility.md if it were setup)

Instead I created a single PR template with a checklist for contributors to complete. This is what it looks like now:

Before you submit this pull request be sure to

- [ ] label the PR appropriately
- [ ] assign it to a suitable project
- [ ] request reviewers
- [ ] associate the PR with one or more issues using [references](https://help.github.com/en/github/writing-on-github/autolinked-references-and-urls#issues-and-pull-requests)

cpritcha avatar May 11 '20 18:05 cpritcha

First 2 required. Second 2 optional. The suggester may not know who to suggest for review. We will ultimately have this worked out but not yet. There may not be an issue for a PR.

cmbarton avatar May 11 '20 19:05 cmbarton

Also, people doing a PR must have permission to label and assign it to a project for this to be meaningful.

cmbarton avatar May 11 '20 19:05 cmbarton

right, I'm not sure this template makes sense for new contributors who by definition will not have any permissions on the repository. But it may be fine for the workshop..

@cpritcha can you explain why multiple pull request templates don't work? From this post it appears that the selection menu isn't available but you can still pass template=FOO.md to select an appropriate PR template.

https://github.community/t5/How-to-use-Git-and-GitHub/Multiple-Pull-Request-Templates/td-p/20909

alee avatar May 11 '20 19:05 alee

It's not a matter a matter of passing the template on pr creation time as a query parameter it's a matter of getting to that page in the first place. When you click on the suggest edits button you get to a page to edit the markdown document and commit the results. Passing a template query parameter to https://github.com/openmodelingfoundation/openmodelingfoundation.github.io/edit/develop/content/en/conformance/documentation/_index.md doesn't pass the template parameter on the create pull request page. It needs to be on something like https://github.com/openmodelingfoundation/openmodelingfoundation.github.io/compare/develop...interop-edits?template=accessibility.md

cpritcha avatar May 11 '20 19:05 cpritcha

That makes total sense now, thanks for clarifying! I forgot the edit page isn't the create PR page and we'd need to thread that template query parameter into the "Create pull request" somehow..

alee avatar May 11 '20 19:05 alee

The check list does not work and needs to be rethought. It pops up in the description box (in edit form not clean preview) at the time to actually create the PR. But at that stage, it is not possible to label the PR, assign it to a project, etc. So people will look at this and go 'how can I do that'?

cmbarton avatar May 12 '20 22:05 cmbarton

Is it no longer possible to assign a PR to a project? No option to do so for me.

cmbarton avatar May 12 '20 22:05 cmbarton

I see. The projects have all disappeared. What happened?

cmbarton avatar May 12 '20 22:05 cmbarton

Ah. Because the projects have been moved to the root, they are no longer available to openmodelingfoundation/openmodelingfoundation.github.io.

Was this what was intended?

cmbarton avatar May 12 '20 22:05 cmbarton

The check list does not work and needs to be rethought. It pops up in the description box (in edit form not clean preview) at the time to actually create the PR. But at that stage, it is not possible to label the PR, assign it to a project, etc. So people will look at this and go 'how can I do that'?

You should be able to edit the text when you create the PR and assign labels at creation time as the screenshot below shows. Were the label side panels etc not available to you?

pull-request-example

@seanbergin what do you see when you make a pull request now?

cpritcha avatar May 12 '20 22:05 cpritcha

they were not

cmbarton avatar May 12 '20 23:05 cmbarton

Ah. Because the projects have been moved to the root, they are no longer available to openmodelingfoundation/openmodelingfoundation.github.io.

Was this what was intended?

You should still be able to see projects, but they live under the "Organization", not the "Repository" now:

image

alee avatar May 12 '20 23:05 alee

I can label, but there is nothing selectable in projects for me (no little gear icon).

cmbarton avatar May 12 '20 23:05 cmbarton

they were not

I can return to labeling after I've created the PR. But not when the list comes up originally. See attached screenshot. PR screen shot

cmbarton avatar May 12 '20 23:05 cmbarton

I just modified some of the permissions for the @openmodelingfoundation/editors team, can you or any other available editors check if the projects show up in https://github.com/openmodelingfoundation/openmodelingfoundation.github.io/pull/64 now?

alee avatar May 12 '20 23:05 alee

I see the four standard projects.

From: A Lee [email protected] Reply-To: "openmodelingfoundation/openmodelingfoundation.github.io" [email protected] Date: Tuesday, May 12, 2020 at 4:36 PM To: "openmodelingfoundation/openmodelingfoundation.github.io" [email protected] Cc: Marco Janssen [email protected], Team mention [email protected] Subject: Re: [openmodelingfoundation/openmodelingfoundation.github.io] consider using GitHub actions to automatically label PRs (#49)

I just modified some of the permissions for the @openmodelingfoundation/editorshttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_orgs_openmodelingfoundation_teams_editors&d=DwMCaQ&c=l45AxH-kUV29SRQusp9vYR0n1GycN4_2jInuKy6zbqQ&r=_31Kpx6U-7yLqxVCk7fQSdLdkGphpL2RA9EIbNVgGW0&m=XMrQC4DRkC_iMQy6JOVtE5WCKV_B7j71EdrMK1K09K4&s=fbCcow4FqF3NMGw7jfhNPUn_MEwILv9-hlB1VPtmthI&e= team, can you or any other available @editors check if the projects show up now?

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openmodelingfoundation_openmodelingfoundation.github.io_issues_49-23issuecomment-2D627656193&d=DwMCaQ&c=l45AxH-kUV29SRQusp9vYR0n1GycN4_2jInuKy6zbqQ&r=_31Kpx6U-7yLqxVCk7fQSdLdkGphpL2RA9EIbNVgGW0&m=XMrQC4DRkC_iMQy6JOVtE5WCKV_B7j71EdrMK1K09K4&s=ehue5nA3nPRv4oCcJOB6h0VMLRfCNMKLKN3gufxoqak&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AFKRXCU5Y7CMSXSNGOGJ4HLRRHMOLANCNFSM4M6BZQGQ&d=DwMCaQ&c=l45AxH-kUV29SRQusp9vYR0n1GycN4_2jInuKy6zbqQ&r=_31Kpx6U-7yLqxVCk7fQSdLdkGphpL2RA9EIbNVgGW0&m=XMrQC4DRkC_iMQy6JOVtE5WCKV_B7j71EdrMK1K09K4&s=YNF3A8PdxdpAXrH393YTwr7t20cq2J67LW7bH9IUKSY&e=.

MarcoAJanssen avatar May 13 '20 02:05 MarcoAJanssen

It looks like this may be possible now with the new pull_request_target event type (see https://github.community/t/github-actions-are-severely-limited-on-prs/18179/15) - @cpritcha or @chrstngyn would you like to take a look and see if this lets us auto-assign PRs again?

alee avatar Oct 07 '20 00:10 alee