fixed milestone id
This commit is contained in:
parent
caa077592a
commit
1a322904f2
@ -19,7 +19,7 @@ jobs:
|
|||||||
rename:
|
rename:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
downloadUrl: ${{ steps.Rename.outputs.milestoneId }}
|
milestoneId: ${{ steps.Rename.outputs.milestoneId }}
|
||||||
steps:
|
steps:
|
||||||
- id: Rename
|
- id: Rename
|
||||||
run: |
|
run: |
|
||||||
@ -32,21 +32,21 @@ jobs:
|
|||||||
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
# Extract the ID of the ${{ inputs.currentName }} milestone
|
# Extract the ID of the ${{ inputs.currentName }} milestone
|
||||||
update_milestone_id=$(echo "$milestones" | jq '.[] | select(.title == "${{ inputs.currentName }}") | .id')
|
milestoneId=$(echo "$milestones" | jq '.[] | select(.title == "${{ inputs.currentName }}") | .id')
|
||||||
|
|
||||||
if [ -z "$update_milestone_id" ]; then
|
if [ -z "$milestoneId" ]; then
|
||||||
echo "No milestone named '${{ inputs.currentName }}' found. Exiting."
|
echo "No milestone named '${{ inputs.currentName }}' found. Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Found '${{ inputs.currentName }}' milestone with ID: $update_milestone_id"
|
echo "Found '${{ inputs.currentName }}' milestone with ID: $milestoneId"
|
||||||
|
|
||||||
echo "Rename the '${{ inputs.currentName }}' milestone to '${{ inputs.newName }}"
|
echo "Rename the '${{ inputs.currentName }}' milestone to '${{ inputs.newName }}"
|
||||||
new_name="${{ inputs.newName }}"
|
new_name="${{ inputs.newName }}"
|
||||||
milestone_update=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \
|
milestone_update=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"title\": \"$new_name\", \"state\": \"closed\"}" \
|
-d "{\"title\": \"$new_name\", \"state\": \"closed\"}" \
|
||||||
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones/$update_milestone_id")
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones/$milestoneId")
|
||||||
|
|
||||||
echo "Renamed '${{ inputs.currentName }}' milestone to $new_name: $milestone_update"
|
echo "Renamed '${{ inputs.currentName }}' milestone to $new_name: $milestone_update"
|
||||||
|
|
||||||
@ -61,5 +61,5 @@ jobs:
|
|||||||
-d "$milestone_data" \
|
-d "$milestone_data" \
|
||||||
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
echo "milestoneId=$update_milestone_id" >> $GITHUB_OUTPUT
|
echo "milestoneId=$milestoneId" >> $GITHUB_OUTPUT
|
||||||
echo "Created new '${{ inputs.currentName }}' milestone: $response"
|
echo "Created new '${{ inputs.currentName }}' milestone: $response"
|
Loading…
Reference in New Issue
Block a user