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

Project Management: Assign issues 'fixed' by a PR to the author of th… #16700

Merged
merged 1 commit into from
Jul 29, 2019

Conversation

noisysocks
Copy link
Member

@noisysocks noisysocks commented Jul 22, 2019

Adds a GitHub Action which, when a pull request is opened, searches the pull request description for 'Fixes #XXXX' and, for each found issue:

  • Adds the author of the pull request as an assignee.
  • Adds the [Status] In Progress label.

Testing

I'm unable to test this on GitHub because my personal GitHub account doesn't have access to GitHub Actions.

I tested it locally by:

  1. Generate a personal access token with the public_repo permission.
  2. Create a mock pull request event and save it as event.json:
{
  "pull_request": {
    "body": "Lorem ipsum etc etc. Fixes #1.\nCloses 2",
	"user": {
	  "login": "noisysocks"
	}
  }
}
  1. Run the action, replacing INSERT_TOKEN_HERE with the token generated above:
docker build .github/actions/assign-fixed-issues/ -t assign-fixed-issues
docker run -v `pwd`:`pwd` -w `pwd` -e GITHUB_EVENT_PATH=event.json -e GITHUB_TOKEN=INSERT_TOKEN_HERE -e GITHUB_REPOSITORY=noisysocks/gutenberg -it assign-fixed-issues

…at PR

Adds a GitHub Action which, when a pull request is opened, searches the
pull request description for 'Fixes #XXXX' and, for each found issue:

- Adds the author of the pull request as an assignee.
- Adds the `[Status] In Progress` label.
@noisysocks noisysocks added the Framework Issues related to broader framework topics, especially as it relates to javascript label Jul 22, 2019
@noisysocks noisysocks requested review from talldan and aduth July 22, 2019 06:13

action "Filter opened" {
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24"
args = "action opened"
Copy link
Member Author

Choose a reason for hiding this comment

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

Right now I'm only handling the case where a pull request is opened. If one edited an existing pull request to include a 'Fixes #XXXX', the action would not pick it up. I'm thinking that this is fine for now and that we can build our way up once we're more confident in the action.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think to avoid annoying Github filters links in the PR @aduth moved these filters to the entry point script instead. Should we do the same?

Copy link
Member

Choose a reason for hiding this comment

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

My changes in #16702 weren't related to the spamming of the checks box. I did replace the filtering, partly on a hunch that it might explain inadvertent cancellations we've been seeing when using GitHub's canonical actions/bin repository (the cancellations occur in this container).

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think I should have any filtering in the entry point script here?

Copy link
Member

Choose a reason for hiding this comment

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

Do you think I should have any filtering in the entry point script here?

It's hard to say. In a perfect world, the way you've implemented it would be correct. The problem we were seeing which led to #16702 was that this step was frequently being cancelled unexpected. I have an open ticket with GitHub support which they've repeatedly deferred, so the changes there were meant as an experiment on our end to determine whether it might provide any more stability to our GitHub Actions workflows.

So far: The cancellations have stopped. But now we're seeing another new issue that they've become perpetually queued ¯\_(ツ)_/¯ [1] [2]

For the purposes of your pull request, I'd say to keep it as you've implemented, but expect that it unfortunately may not work very reliably.

Copy link
Member

Choose a reason for hiding this comment

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

To the original question: I think your proposal as it stands now is reasonable, and if we want additional coverage later, it can come as a future enhancement.

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

I've not actually run the code, but it reads sensibly, and looks to adopt many of the conventions I incorporated in #15826. Let's give it a try, and pay attention to new pull requests to sort through any issues we encounter. Nice work here 👍

# 1. Find the issues that this PR 'fixes'.

issues=$(
jq -r '.pull_request.body' $GITHUB_EVENT_PATH | perl -nle 'print $1 while /
Copy link
Member

Choose a reason for hiding this comment

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

As I noted in #15826 (comment), I feel like shell-based custom actions might become a pain-point for maintenance. For example, I'm not particularly comfortable with this (assuredly simple) Perl script. Since the work has already been done here, I'd not advocate to change it, but I think in the future we should consider whether to just use our collective JavaScript knowledge and encourage that these be written as Node scripts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed!


action "Filter opened" {
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24"
args = "action opened"
Copy link
Member

Choose a reason for hiding this comment

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

To the original question: I think your proposal as it stands now is reasonable, and if we want additional coverage later, it can come as a future enhancement.

-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labels":["[Status] In Progress"]}' \
Copy link
Member

Choose a reason for hiding this comment

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

We'll need to note to update this if we ever decide to reword these labels in the future.

@draganescu draganescu merged commit f598210 into master Jul 29, 2019
@github-actions github-actions bot added this to the Gutenberg 6.3 milestone Jul 29, 2019
@youknowriad youknowriad deleted the add/assign-fixed-issues-workflow branch July 29, 2019 15:17
gziolo pushed a commit that referenced this pull request Aug 29, 2019
…at PR (#16700)

Adds a GitHub Action which, when a pull request is opened, searches the
pull request description for 'Fixes #XXXX' and, for each found issue:

- Adds the author of the pull request as an assignee.
- Adds the `[Status] In Progress` label.
gziolo pushed a commit that referenced this pull request Aug 29, 2019
…at PR (#16700)

Adds a GitHub Action which, when a pull request is opened, searches the
pull request description for 'Fixes #XXXX' and, for each found issue:

- Adds the author of the pull request as an assignee.
- Adds the `[Status] In Progress` label.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants