Skip to content

workflow: Added workflow to update issue status to 'In Development' w… #11

workflow: Added workflow to update issue status to 'In Development' w…

workflow: Added workflow to update issue status to 'In Development' w… #11

name: Update Issue Status to In Development
on:
push:
branches:
- '*-*'
jobs:
update-status:
runs-on: ubuntu-latest
steps:
- name: Extract Issue Number from Branch Name
id: extract-issue-number
run: |
ISSUE_NUMBER=$(echo $GITHUB_REF_NAME | cut -d'-' -f1)
echo "Issue Number extracted: $ISSUE_NUMBER"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
item_id=$(gh api graphql -f query='
query($project:ID!, $number:Int!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}' -f project=$PROJECT_ID -f number=$ISSUE_NUMBER --jq ".data.node.items.nodes[] | select(.content.number == $ISSUE_NUMBER) | .id")
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else:
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
- name: Set status to In Development
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
run: |
echo "Setting status for Project Item ID: $PROJECT_ITEM_ID"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="in_development_option_id") # Replace "in_development_option_id" with your actual option ID for "In Development"
echo "Set status result: $result"