@@ -18,44 +18,41 @@ jobs:
1818 env :
1919 GH_TOKEN : ${{ secrets.UPDATE_PROJECT_V2_PAT }}
2020 run : |
21- echo "🔍 Listing all project items linked to issue ${{ github.event.issue.number }}..."
21+ echo "🔍 Listing all project items linked to issue # ${{ github.event.issue.number }}..."
2222 gh issue view ${{ github.event.issue.number }} \
2323 --repo ${{ github.repository }} \
2424 --json projectItems \
2525 | jq .
2626
27- - name : Set Remaining Days to 0 if issue is in Project 183
27+ - name : Update Remaining Days if issue is in "React Native Planning"
2828 env :
2929 GH_TOKEN : ${{ secrets.UPDATE_PROJECT_V2_PAT }}
3030 run : |
31- echo "🔍 Checking if issue ${{ github.event.issue.number }} belongs to Project 183..."
32-
33- # Get the project item ID from projectItems
31+ # Extract ITEM_ID where project title == "React Native Planning"
3432 ITEM_ID=$(gh issue view ${{ github.event.issue.number }} \
3533 --repo ${{ github.repository }} \
3634 --json projectItems \
37- | jq -r '.projectItems[] | select(.project.number==183 ) | .id')
35+ | jq -r '.projectItems[] | select(.title=="React Native Planning" ) | .id')
3836
3937 if [ -z "$ITEM_ID" ]; then
40- echo "ℹ️ Issue is not in Project 183 . Nothing to update."
38+ echo "ℹ️ Issue is not in project 'React Native Planning' . Nothing to update."
4139 exit 0
4240 fi
4341
44- echo "✅ Found Project Item ID in Project 183 : $ITEM_ID"
42+ echo "✅ Found Project Item ID in 'React Native Planning' : $ITEM_ID"
4543
46- # Find the field ID for "Remaining Days"
47- FIELD_ID=$(gh project field-list --owner microsoft --number 183 -- format json \
44+ # Find the field ID for "Remaining Days" in that project
45+ FIELD_ID=$(gh project field-list --owner microsoft --format json \
4846 | jq -r '.[] | select(.name=="Remaining Days") | .id')
4947
5048 if [ -z "$FIELD_ID" ]; then
51- echo "❌ No field named 'Remaining Days' found in Project 183 ."
49+ echo "❌ No field named 'Remaining Days' found."
5250 exit 1
5351 fi
5452
5553 echo "✅ Found Field ID for Remaining Days: $FIELD_ID"
5654
5755 # Update the field value to 0
58- gh project item-update --owner microsoft --number 183 \
59- --id "$ITEM_ID" --field-id "$FIELD_ID" --value "0"
56+ gh project item-update --id "$ITEM_ID" --field-id "$FIELD_ID" --value "0"
6057
61- echo "🎉 Successfully set Remaining Days = 0 for issue ${{ github.event.issue.number }}"
58+ echo "🎉 Successfully set Remaining Days = 0 for issue # ${{ github.event.issue.number }}"
0 commit comments