Skip to content

Commit

Permalink
Resolving issue with update-issue-status
Browse files Browse the repository at this point in the history
  • Loading branch information
Belle P authored and Belle P committed Nov 18, 2024
1 parent 50b5e76 commit 5ae8643
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/update-issue-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,39 @@ jobs:

- name: Move Issue Card to 'Done' Column in Project
run: |
# Ensure the issue number is properly assigned
issue_number=${{ needs.check-pr-for-issue.outputs.issue-number }}
echo "Moving issue #$issue_number to 'Done' column in the project..."
# Fetch the issue details (we'll use the GitHub API to find the project)
# Fetch the issue details (we'll use the GitHub API to find the project cards)
project_url="https://api.github.com/repos/${{ github.repository }}/issues/$issue_number"
# Get the project cards associated with the issue
project_cards=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s $project_url/labels)
project_cards=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s $project_url)
# Look for the first project card in the response and move it to the 'Done' column
project_card_id=$(echo "$project_cards" | jq -r '.[0].id') # You'll need to use jq to parse the response and get the card ID
# Debug: Print the project cards JSON to check the structure
echo "Project Cards: $project_cards"
# Now move the card to the 'Done' column (assuming the column ID is known or obtained earlier)
# Extract the first project card ID from the JSON response (if it exists)
project_card_id=$(echo "$project_cards" | jq -r '.[0].id')
if [ -z "$project_card_id" ]; then
echo "No project card found for issue #$issue_number"
exit 1
fi
echo "Found project card ID: $project_card_id"
# Specify the 'Done' column ID (replace this with your actual column ID)
done_column_id=<YOUR_DONE_COLUMN_ID>
if [ -z "$done_column_id" ]; then
echo "Done column ID not set. Please provide a valid column ID."
exit 1
fi
# Move the project card to the 'Done' column
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"column_id": "'$done_column_id'"}' \
"https://api.github.com/projects/columns/cards/$project_card_id/moves"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5ae8643

Please sign in to comment.