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

Add a workflow to add issues/PRs to projects. #94447

Merged
merged 2 commits into from
Jul 1, 2022
Merged

Conversation

ezio-melotti
Copy link
Member

This PR adds a workflow that uses the "Add to GitHub Projects Beta" action to automatically add issues and PRs that have been created or labeled to the corresponding project.

So far it only updates the Release and Deferred blocker project, but if that works well we can update the workflow to include other projects that have corresponding labels. This will also solves in the short term the issue of triagers not being able to update projects from an issue/PR.

cc @encukou, @hugovk, @CAM-Gerlach

@hugovk
Copy link
Member

hugovk commented Jun 30, 2022

Great to see GitHub has finally created https://github.com/actions/add-to-project that works with new beta boards! At work, we've been using one based on this GraphQL API, we'll have to switch over :)

@@ -0,0 +1,23 @@
name: Update projects when an issue/PR is created/labeled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name shows in the left bar at https://github.com/python/cpython/actions, can we make it a bit shorter?

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want something about "projects" being "updated", and possibly "GitHub projects" or "(beta) projects" since "projects" is a bit generic. Mentioning "labels" would also be good, since they are the trigger of the action.

Is "Update GH projects on label change" good? The last word might not fit, but it's not essential. Otherwise I can just drop the "GH" and it should fit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, "GH" is more important to keep than "change", since otherwise I think it would be confusing and unclear what projects were being referred to, whereas change just clarifies the exact trigger but as you say, is not essential to understanding meaning

.github/workflows/project-updater.yml Show resolved Hide resolved
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
@ezio-melotti ezio-melotti merged commit 5f2c91a into main Jul 1, 2022
@ezio-melotti ezio-melotti deleted the project-updater branch July 1, 2022 08:33
@ezio-melotti
Copy link
Member Author

I merged this and:

  • I tested that the issue is added to the project when:
    • the release-blocker label is applied
    • the deferred-blocker label is applied
  • removing the label doesn't remove the issue from the project
  • there doesn't seem to be a way to set the type automatically from the action
    • it can be set manually either in the issue or in the project
  • it takes about 10-15s before the issue (dis)appears in the project
  • a manual refresh on the issue is needed before the project (dis)appears in the sidebar

@ezio-melotti ezio-melotti added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Jul 1, 2022
@miss-islington
Copy link
Contributor

Thanks @ezio-melotti for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @ezio-melotti for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry @ezio-melotti, I had trouble checking out the 3.11 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 5f2c91a343fb20f8c2fc78cbb3e68234bcba40a8 3.11

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 1, 2022
@bedevere-bot
Copy link

GH-94475 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 1, 2022
* Add a workflow to add issues/PRs to projects.

* Apply suggestions from code review

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 5f2c91a)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@ezio-melotti ezio-melotti added needs backport to 3.11 only security fixes and removed needs backport to 3.11 only security fixes labels Jul 1, 2022
@miss-islington
Copy link
Contributor

Thanks @ezio-melotti for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 1, 2022
* Add a workflow to add issues/PRs to projects.

* Apply suggestions from code review

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 5f2c91a)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 1, 2022
@bedevere-bot
Copy link

GH-94477 is a backport of this pull request to the 3.11 branch.

@ezio-melotti
Copy link
Member Author

The two backport PRs are failing with Error: Input required and not supplied: github-token, likely because they are created in miss-islington fork, and forks can't access secrets.

We could either limit the check on PRs made against main, or remove the check for PRs entirely, under the assumption that release/deferred-blockers should have a corresponding issue with the same labels.

This will also reduce the amount of checks that show up for PRs, especially once we start adding automation for the other label/projects, since I'm afraid each project will require a different job that will show up as a different check in the output:
image

@terryjreedy
Copy link
Member

terryjreedy commented Jul 24, 2022

I created today https://github.com/orgs/python/projects/31/views/1. For some reason, it does not appear in the python projects list https://github.com/python/cpython/projects?type=new. Does that take time? Or did I make a mistake? In any case, I would love to have IDLE issues (but not PRs - although Linked Pull Requests does not work) auto added to this project.

@ezio-melotti
Copy link
Member Author

For some reason, it does not appear in the python projects list

Beta projects are created at the org level, and need to be manually added to the repos if you want them to show up in the repo's list of projects. It seems that your project has been now added to the list.

In any case, I would love to have IDLE issues (but not PRs - although Linked Pull Requests does not work) auto added to this project.

Auto-adding to projects is being worked on at python/core-workflow#467. This only affects issues, not PRs. Linked PRs only work if the PR is actually linked to an issue, either by using an auto-closing keywork (e.g. fixes #12345) or by manually linking in the sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants