diff options
author | Adeel Mujahid <3840695+am11@users.noreply.github.com> | 2022-05-23 18:31:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 18:31:52 +0300 |
commit | 017905c855e28abeb250ae84198c6404515036e8 (patch) | |
tree | 13384de000f3d603e5ab329c8a88dbf43235b8c6 /.github | |
parent | a0ff92c8d3cb3cb3b35357117e629cdd19f7080a (diff) |
Use a better endpoint for backport workflows runs (#69617)
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/backport.yml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 3f7a3dda71a..68b18cfb5ee 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -22,12 +22,16 @@ jobs: steps: - name: Delete old workflow runs run: | - _UrlPath="/repos/$GITHUB_REPOSITORY/actions/runs" + _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 \ - | jq '.workflow_runs[] | select(.name == '\""$GITHUB_WORKFLOW"\"' and .status == "completed") | .id' \ + | jq '.workflow_runs[] | select(.status == "completed") | .id' \ | xargs -I{} gh api -X DELETE "$_UrlPath"/{} backport: |