Skip to content

Commit 229fc4a

Browse files
authored
Fix update-issue-remaining-days.yml (#15059)
* Fix update-issue-remaining-days.yml * Update update-issue-remaining-days.yml
1 parent a6eaa6c commit 229fc4a

1 file changed

Lines changed: 43 additions & 7 deletions

File tree

.github/workflows/update-issue-remaining-days.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,46 @@ jobs:
88
update_remaining_days:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Set Remaining Days to 0 in Project 183
12-
uses: nipe0324/update-project-v2-item-field@v2.0.2
13-
with:
14-
project-url: https://github.com/orgs/microsoft/projects/183
15-
github-token: ${{ secrets.UPDATE_PROJECT_V2_PAT }}
16-
field-name: "Remaining Days"
17-
field-value: "0"
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Install jq
15+
run: sudo apt-get update && sudo apt-get install -y jq
16+
17+
- name: Debug - List project items
18+
env:
19+
GH_TOKEN: ${{ secrets.UPDATE_PROJECT_V2_PAT }}
20+
run: |
21+
echo "Listing all project items in Microsoft Project 183 for debugging..."
22+
gh project item-list 183 --owner microsoft --format json | jq .
23+
24+
- name: Set Remaining Days to 0 in Microsoft Project 183
25+
env:
26+
GH_TOKEN: ${{ secrets.UPDATE_PROJECT_V2_PAT }}
27+
run: |
28+
# Find the project item ID for the issue that triggered the workflow
29+
ITEM_ID=$(gh project item-list 183 --owner microsoft --format json \
30+
| jq -r ".[] | select(.content.url==\"${{ github.event.issue.html_url }}\") | .id")
31+
32+
if [ -z "$ITEM_ID" ]; then
33+
echo "❌ No project item found for issue: ${{ github.event.issue.html_url }}"
34+
exit 1
35+
fi
36+
37+
echo "✅ Found Project Item ID: $ITEM_ID"
38+
39+
# Find the field ID for "Remaining Days"
40+
FIELD_ID=$(gh project field-list 183 --owner microsoft --format json \
41+
| jq -r '.[] | select(.name=="Remaining Days") | .id')
42+
43+
if [ -z "$FIELD_ID" ]; then
44+
echo "❌ No field named 'Remaining Days' found in Project 183."
45+
exit 1
46+
fi
47+
48+
echo "✅ Found Field ID for Remaining Days: $FIELD_ID"
49+
50+
# Update the field value to 0
51+
gh project item-update 183 --owner microsoft --id "$ITEM_ID" --field-id "$FIELD_ID" --value "0"
52+
53+
echo "🎉 Successfully set Remaining Days = 0 for issue ${{ github.event.issue.number }}"

0 commit comments

Comments
 (0)