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

Workflows: Add automation for github project to pass a PR being reviewed directly in good column #2101

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/update-pr-review-in-progress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Move card to Dev Review in Progess column
on:
pull_request_review:
types:
- submitted

jobs:
move_card_to_dev_review_in_progress:
if: github.event.pull_request.draft == false && github.event.review.state != 'approved' && github.event.review.user != ${{ vars.LEAD_DEV_GH_USERNAME }} && github.event.review.user != ${{ vars.A11Y_REVIEWER_GH_USERNAME }}
runs-on: ubuntu-latest
steps:
- name: Get Project Data
env:
GITHUB_TOKEN: ${{ secrets.BOOSTED_MOD_PERSONAL_TOKEN_CLASSIC }}
ORGANIZATION: ${{ github.repository_owner }}
PR_ID: ${{ github.event.pull_request.node_id }}
PROJECT_NUMBER: ${{ vars.PR_BOARD_PROJECT_NUMBER }}
PROJECT_TARGET_COL: ${{ vars.PR_BOARD_DEV_REVIEW_IN_PROGRESS_COL_NAME }}
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectV2(number: $number) {
id
fields(first:20) {
nodes {
... on ProjectV2Field {
id
name
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
items(first:20) {
nodes {
id
content {
... on PullRequest {
id
}
}
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json

# echo `cat project_data.json`

echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
echo 'TARGET_COL_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="${{ env.PROJECT_TARGET_COL }}") |.id' project_data.json) >> $GITHUB_ENV
echo 'ITEM_ID='$(jq '.data.organization.projectV2.items.nodes[] | select(.content.id=="${{ env.PR_ID }}") |.id' project_data.json) >> $GITHUB_ENV

- name: Move to Dev Review in Progress Column
env:
GITHUB_TOKEN: ${{ secrets.BOOSTED_MOD_PERSONAL_TOKEN_CLASSIC }}
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$status_field: ID!
$status_value: String!
) {
set_status: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $status_field
value: {
singleSelectOptionId: $status_value
}
}) {
projectV2Item {
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TARGET_COL_ID }} --silent
Loading