Skip to content

Commit 4ded4e1

Browse files
authored
Update 99-add-issue-to-project.yml
1 parent 68eabf1 commit 4ded4e1

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/99-add-issue-to-project.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,25 @@ jobs:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434
DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }}
3535
run: |
36+
project_number=$(echo $DEV_PROJECT_ID | jq -r '.split("/")[-1]') # Optional if $DEV_PROJECT_ID is full URL, otherwise remove this line.
3637
columns=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
37-
-H "Accept: application/vnd.github.v3+json" \
38-
"https://api.github.com/projects/$DEV_PROJECT_ID/columns")
39-
40-
echo "Columns Response: $columns"
38+
-H "Accept: application/vnd.github.inertia-preview+json" \
39+
"https://api.github.com/projects/$project_number/columns")
40+
41+
echo "Columns response: $columns"
4142
42-
column_id=$(echo $columns | jq -r 'map(select(.name == "No Status")) | .[0].id')
43-
echo "COLUMN_ID=$column_id" >> $GITHUB_ENV
43+
if echo "$columns" | jq -e . >/dev/null 2>&1; then
44+
column_id=$(echo $columns | jq -r '.[] | select(.name=="No Status") | .id')
45+
if [ -n "$column_id" ]; then
46+
echo "COLUMN_ID=$column_id" >> $GITHUB_ENV
47+
else
48+
echo "No column found with the name 'No Status'."
49+
exit 1
50+
fi
51+
else
52+
echo "Failed to parse columns response as JSON."
53+
exit 1
54+
fi
4455
4556
- name: Add issue to project
4657
env:

0 commit comments

Comments
 (0)