Skip to content

Commit

Permalink
[Feature:Developer] Move review requested PR to In Review (Submitty#1…
Browse files Browse the repository at this point in the history
…0848)

### What is the current behavior?
Currently, there is no project board automation for moving PRs to the
"In Review" column. It is very easy to forget to do this, so some PRs
get lost as a result.

### What is the new behavior?
This PR automates moving a PR to "In Review" when a reviewer is
requested, for PRs in the Submitty/Submitty repo.

After this PR, this is the project management flowchart. This PR adds
the "Reviewer assigned" automation.


![current](https://github.com/user-attachments/assets/ea3d4e73-c25a-4991-8eaa-bdb081503062)

---------

Co-authored-by: William Allen <[email protected]>
  • Loading branch information
powe97 and williamjallen authored Aug 15, 2024
1 parent 516537e commit bf9c3c6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/move_to_in_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Move PR to In Review
on:
pull_request_target:
types:
- review_requested

env:
PR_ID: ${{ github.event.pull_request.number }}

jobs:
move-to-in-review:
name: Move to In Review
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PEM }}

- name: Get PR project ID
id: get-pr-id
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
PR_PROJECT_ID="$(gh project item-list -L 9999 --owner Submitty 1 --format json --jq "[.items[] | {id, labels, status, title: .content.title, repo: .content.repository, number: .content.number}] | .[] | select(.number == "$PR_ID").id")"
echo "pr-project-id="${PR_PROJECT_ID:?}"" >> "$GITHUB_OUTPUT"
- name: Move PR to In Review
if: ${{ ! github.event.pull_request.draft }}
env:
PR_PROJECT_ID: ${{ steps.get-pr-id.outputs.pr-project-id }}
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
source .github/bin/board_automation_helper.sh
gh project item-edit --project-id "$PROJECT_ID" --id "$PR_PROJECT_ID" --field-id "$STATUS_FIELD_ID" --single-select-option-id "$IN_REVIEW_ID"

0 comments on commit bf9c3c6

Please sign in to comment.