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 Automation: Move PR and Linked Issues to In Progress #170

Merged
merged 9 commits into from
Jul 27, 2023

Conversation

jarmak-nv
Copy link
Collaborator

@jarmak-nv jarmak-nv commented Jul 6, 2023

Description

closes #169

This PR creates a new GitHub action, project_automation_set_in_progress.yml. It uses the ProjectsV2 graphQL API to perform the automations. This was designed to not require any external tools, nor install anything into the Actions runner to minimize runtime.

Steps SEE COMMENT BELOW THE WORKFLOW HAS BEEN SIGNIFICANTLY UPDATED

  • Set up some hard-coded environment variables
    • These are public, static, and in doing so we simplify and accelerate the GHA
    • Should they ever become dynamic, they can be replaced with queries
  • Wait 1 second
    • GitHub can take a moment to link the PR to the issue in their APIs, similarly on opening of a PR the adding to project can take a bit of time
    • We may find more time is needed, but 1s never caused a failure on my end due to the time of spinning up the runner
  • Find out what the PR's Project-Specific ID is
    • The ProjectsV2 API creates a specific ID for each item within a project. It is not directly accessible through the PR unfortunately
  • Find out the PR's current status
    • This action runs any time a PR is opened, or edited
    • Because of the edited trigger (which we need if we want to add additional issue links after opening the PR) it's possible the action could trigger when the PR is in the Review status, or Done
  • If the PR status is Todo or null, update the PR to In Progress
  • If the PR status is Todo or null, update the linked issues to In Progress

All steps have continue-on-error: True so that this action cannot count as a failure when considering it as a CI check. It will make failures silent and we'll need to manually watch for failure, but I think it's an acceptable tradeoff.

(It also adds a missing copyright header to the triage rotation workflow.)

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@jarmak-nv jarmak-nv added feature request New feature or request. infrastructure Shared CMake, github, etc infrastructure labels Jul 6, 2023
@jarmak-nv jarmak-nv requested a review from jrhemstad July 6, 2023 14:26
@jarmak-nv
Copy link
Collaborator Author

After some talks + seeing some potential, I'm reworking this to be a little more "full automation".

@jarmak-nv jarmak-nv marked this pull request as draft July 7, 2023 14:03
@jarmak-nv jarmak-nv marked this pull request as ready for review July 7, 2023 15:46
@jarmak-nv
Copy link
Collaborator Author

jarmak-nv commented Jul 7, 2023

Testing graphQL mutation for setting to draft.

Success!

@jarmak-nv jarmak-nv marked this pull request as draft July 7, 2023 15:47
@jarmak-nv jarmak-nv marked this pull request as ready for review July 10, 2023 18:05
@jarmak-nv
Copy link
Collaborator Author

Workflow Update

There are now 3 actions:

  • Set In Progress
  • Set In Review
  • Synchronize Issues

Set In Progress

This action runs when a PR is opened, converted to a draft, or a review requests changes. It:

  • Sets the PR and linked issues to In Progress
  • Checks if there's a Start Sprint, if not, it sets it to the current Start Sprint
  • Sets the Working Sprint (formerly known as End Sprint) to the current Working Sprint
  • Sets the PR to a draft

Set In Review

This action runs when a PR is marked Ready for Review - promoting from a draft triggers this action. It:

  • Sets the PR and linked issues to In Review

Synchronize Issues

This action runs when the PR is edited, we're interested here because we should be editing in closing keywords for issues if new or old issues are realized to be closed by this PR. It:

  • Finds the current Status Start Sprint and End Sprint from the PR
  • Sets all linked issues to the same values

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we just want to add a project_automation/ directory instead of prefixing the workflow file names?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tbh I didn't know that was an option, I thought all workflows had to be in the .workflows/ folder. Happy to move them and remove the prefix!

Copy link
Collaborator

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

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

I obviously didn't go through all the graphql stuff in detail, but I followed the high level workflow and it looks awesome!

Do we want to update any of the process docs in the Wiki as part of this PR? I really like the idea of having a state diagram in there so it's easy to see at a glance how a PR/issue evolves over time.

Copy link
Collaborator Author

@jarmak-nv jarmak-nv left a comment

Choose a reason for hiding this comment

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

Test "review"

Copy link
Collaborator Author

@jarmak-nv jarmak-nv left a comment

Choose a reason for hiding this comment

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

App Test 2 The functional skip logic made it not generate a token. But it shows as a failure.

@jarmak-nv jarmak-nv marked this pull request as draft July 11, 2023 16:49
@jarmak-nv jarmak-nv marked this pull request as ready for review July 11, 2023 16:51
Copy link
Collaborator

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

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

test requesting changes

@jarmak-nv jarmak-nv requested review from a team as code owners July 27, 2023 14:21
@jarmak-nv jarmak-nv requested review from miscco and removed request for a team July 27, 2023 14:21
@jrhemstad
Copy link
Collaborator

Merging this with the failed check. This failure is expected because the action needs access to repo secrets that aren't available on forks. It has been tested elsewhere and confirmed that it will work once merged.

@jrhemstad jrhemstad merged commit 844566a into NVIDIA:main Jul 27, 2023
368 of 369 checks passed
@jarmak-nv jarmak-nv deleted the issue-pr-project-automation branch August 23, 2023 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request. infrastructure Shared CMake, github, etc infrastructure
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[FEA]: Automate GitHub Projects - Set Status To In Progress for Linked issues to PRs
2 participants