openmodelingfoundation / openmodelingfoundation.github.io

Website for standards and governance of the Open Modeling Foundation
https://openmodelingfoundation.org
Creative Commons Zero v1.0 Universal
52 stars 34 forks source link

consider using GitHub actions to automatically label PRs #49

Open alee opened 4 years ago

alee commented 4 years ago

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!

cmbarton commented 4 years ago

Outstanding!!!

alee commented 4 years ago

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 commented 4 years ago

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

cmbarton commented 4 years ago

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

alee commented 4 years ago

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

cpritcha commented 4 years ago

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)
cmbarton commented 4 years ago

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 commented 4 years ago

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

alee commented 4 years ago

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

cpritcha commented 4 years ago

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

alee commented 4 years ago

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..

cmbarton commented 4 years ago

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 commented 4 years ago

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

cmbarton commented 4 years ago

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

cmbarton commented 4 years ago

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?

cpritcha commented 4 years ago

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?

cmbarton commented 4 years ago

they were not

alee commented 4 years ago

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

cmbarton commented 4 years ago

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

cmbarton commented 4 years ago

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

alee commented 4 years ago

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?

MarcoAJanssen commented 4 years ago

I see the four standard projects.

From: A Lee notifications@github.com Reply-To: "openmodelingfoundation/openmodelingfoundation.github.io" reply@reply.github.com Date: Tuesday, May 12, 2020 at 4:36 PM To: "openmodelingfoundation/openmodelingfoundation.github.io" openmodelingfoundation.github.io@noreply.github.com Cc: Marco Janssen Marco.Janssen@asu.edu, Team mention team_mention@noreply.github.com 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=.

alee commented 3 years ago

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?