Skip to content

Commit

Permalink
adding jq query to get the values
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Aug 14, 2023
1 parent f5a6428 commit 97627e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/check-active-prs-and-slots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ jobs:
- name: Get list of active PRs
id: prList
run: |
$active_prs=$(gh pr list --state open | awk '{print $1}')
$active_prs=$(gh pr list --state open --json number | jq -r '.[].number')
echo $active_prs
echo "active_prs=$active_prs" >> $env:GITHUB_OUTPUT
- name: Compare PRs with Slots
id: comparision
run: |
# Comparing the number of Slots and PRs
$PRList = "${{ steps.PRList.outputs.active_prs }}" -split ' '
$SlotList = "${{ steps.slotList.outputs.slots }}" -split ' '
$prList = "${{ steps.PRList.outputs.active_prs }}" -split ' '
$slotList = "${{ steps.slotList.outputs.slots }}" -split ' '
$slotsExistThatRequireDeletion = $SlotList | Where-Object { $_ -notin $PRList }
$slotsExistThatRequireDeletion = $slotList | Where-Object { $_ -notin $prList }
# $slotsExistThatRequireDeletion ='111 112'
$slotsNeedDeletion = $slotsExistThatRequireDeletion.Length -gt 0
Expand All @@ -86,6 +87,7 @@ jobs:
run: |
# Slots that need to be deleted
$slotsExistThatRequireDeletion = ${{steps.comparision.outputs.slotsExistThatRequireDeletion }}
Write-Host "⚡- These slots need to be deleted : $slotsExistThatRequireDeletion"
echo "slotIDs=$slotsExistThatRequireDeletion" >> $env:GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close-delete-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
inputs:
slotIDs:
type: string
description: "Slot ID (Add multiple IDs seperated by a space)"
description: "Slot IDs"
required: true

defaults:
Expand Down

0 comments on commit 97627e8

Please sign in to comment.