Update LICENSE #10665
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gardener Issue Comment | |
# | |
# This workflow moves GH issues from the Gardener board's "Blocked / Waiting" column | |
# to "Triage", when a comment is posted on an issue from a non-team member | |
# so that the Gardener can assess the issue in light of new information. | |
name: Gardener Issue Comment | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
move-to-backlog: | |
name: Move issues back to Gardener project board Triage | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
if: ${{ !github.event.issue.pull_request }} | |
steps: | |
- name: Generate authentication token | |
id: generate_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a | |
with: | |
app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} | |
private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} | |
- name: Get PR comment author | |
id: comment | |
uses: tspascoal/get-user-teams-membership@v3 | |
with: | |
username: ${{ github.actor }} | |
team: 'Vector' | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- name: Move issue back to Triage if status is Blocked/Waiting | |
if: steps.comment.outputs.isTeamMember == 'false' | |
env: | |
GH_TOKEN: ${{ secrets.GH_PROJECT_PAT }} | |
run: | | |
issue_id=${{ github.event.issue.node_id }} | |
echo "issue_id: $issue_id" | |
# IDs fetched from https://docs.github.com/en/graphql/overview/explorer | |
project_id="PVT_kwDOAQFeYs4AAsTr" # Gardener | |
status_field_id="PVTF_lADOAQFeYs4AAsTrzgAXRuU" # Status | |
triage_option_id="2a08fafa" | |
# Query for project items for the given issue | |
project_items="$(gh api graphql -f query=' | |
query($item_id: ID!) { | |
node(id: $item_id) { | |
... on Issue { | |
projectItems(first: 50) { | |
... on ProjectV2ItemConnection { | |
nodes { | |
fieldValueByName(name: "Status") { | |
... on ProjectV2ItemFieldSingleSelectValue { | |
name | |
} | |
} | |
... on ProjectV2Item { | |
id | |
project { | |
... on ProjectV2 { | |
id | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
... on PullRequest { | |
projectItems(first: 50) { | |
... on ProjectV2ItemConnection { | |
nodes { | |
fieldValueByName(name: "Status") { | |
... on ProjectV2ItemFieldSingleSelectValue { | |
name | |
} | |
} | |
... on ProjectV2Item { | |
id | |
project { | |
... on ProjectV2 { | |
id | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}' -f item_id="$issue_id" | |
)" | |
# Extract the item in the Gardener project | |
project=$(echo $project_items | jq -c -r --arg project_id $project_id '.data.node.projectItems.nodes[] | select(.project.id == $project_id)') | |
current_status=$(echo $project | jq -c -r '.fieldValueByName.name') | |
item_id=$(echo $project | jq -c '.id') | |
if [ -z "$current_status" ] ; then | |
echo "Issue not found in Gardener board" | |
exit 0 | |
else | |
echo "Found issue on Gardener board. Current issue status is: '${current_status}'" | |
fi | |
if [ "$current_status" = "Blocked / Waiting" ] ; then | |
echo "Moving issue from 'Blocked / Waiting' to 'Triage'" | |
gh api graphql -f query=' | |
mutation($project_id: ID!, $item_id: ID!, $field_id: ID!, $option_id: String) { | |
updateProjectV2ItemFieldValue( | |
input: { | |
projectId: $project_id | |
itemId: $item_id | |
fieldId: $field_id | |
value: { | |
singleSelectOptionId: $option_id | |
} | |
} | |
) { | |
projectV2Item { | |
id | |
} | |
} | |
}' -f project_id="$project_id" -f item_id="$item_id" -f field_id="$status_field_id" -f option_id="$triage_option_id" | |
else | |
echo "Issue is in '${current_status}', not moving." | |
fi |