Fix DELETE URL in backport workflow (#69737)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Tue, 24 May 2022 18:45:05 +0000 (21:45 +0300)
committerGitHub <noreply@github.com>
Tue, 24 May 2022 18:45:05 +0000 (20:45 +0200)
.github/workflows/backport.yml

index 68b18cf..4124fa0 100644 (file)
@@ -23,16 +23,13 @@ jobs:
     - name: Delete old workflow runs
       run: |
         _UrlPath="/repos/$GITHUB_REPOSITORY/actions/workflows"
-
         _CurrentWorkflowID="$(gh api -X GET "$_UrlPath" | jq '.workflows[] | select(.name == '\""$GITHUB_WORKFLOW"\"') | .id')"
 
-        _UrlPath="$_UrlPath/$_CurrentWorkflowID/runs"
-
         # delete workitems which are 'completed'. (other candidate values of status field are: 'queued' and 'in_progress')
 
-        gh api -X GET "$_UrlPath" --paginate \
+        gh api -X GET "$_UrlPath/$_CurrentWorkflowID/runs" --paginate \
           | jq '.workflow_runs[] | select(.status == "completed") | .id' \
-          | xargs -I{} gh api -X DELETE "$_UrlPath"/{}
+          | xargs -I{} gh api -X DELETE "/repos/$GITHUB_REPOSITORY/actions/runs"/{}
 
   backport:
     if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/backport to')