fixed milestone id
This commit is contained in:
		| @@ -19,7 +19,7 @@ jobs: | ||||
|   rename: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       downloadUrl: ${{ steps.Rename.outputs.milestoneId }} | ||||
|       milestoneId: ${{ steps.Rename.outputs.milestoneId }} | ||||
|     steps: | ||||
|       - id: Rename | ||||
|         run: | | ||||
| @@ -32,21 +32,21 @@ jobs: | ||||
|             "$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones") | ||||
|  | ||||
|           # 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." | ||||
|             exit 1 | ||||
|           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 }}" | ||||
|           new_name="${{ inputs.newName }}" | ||||
|           milestone_update=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \ | ||||
|             -H "Content-Type: application/json" \ | ||||
|             -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" | ||||
|  | ||||
| @@ -61,5 +61,5 @@ jobs: | ||||
|             -d "$milestone_data" \ | ||||
|             "$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" | ||||
		Reference in New Issue
	
	Block a user