Skip to content

Commit

Permalink
fix jq syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman committed Sep 14, 2023
1 parent 0b7b379 commit 8fd43c6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
# Split Mergify's ref name (e.g. 'heads/pull/*/mergify/bp/stable/0.25/pr-10828') on the
# final '-' to get the number of the PR that triggered Mergify.
# Split Mergify's ref name (e.g. 'mergify/bp/stable/0.25/pr-10828') on the final '-' to
# get the number of the PR that triggered Mergify.
IFS='-' read -ra split <<< "${{ github.event.pull_request.head.ref }}"
base_pr=${split[-1]}
gh pr --repo "${{ github.repository }}" view "$base_pr" --json labels,milestone > base_pr.json
add_labels="$(jq '[.labels[].name] - ["stable backport potential"] | join(",")' base_pr.json)"
add_labels="$(jq --raw-output '[.labels[].name] - ["stable backport potential"] | join(",")' base_pr.json)"
echo "New labels: '$add_labels'"
# 'jq' converts a JSON 'null' into the empty string.
milestone="$(jq '.milestone' base_pr.json)"
milestone="$(jq --raw-output '.milestone.title // ""' base_pr.json )"
echo "Milestone: '$milestone'"
echo "Targetting current PR '${{ github.event.number }}'"
Expand Down

0 comments on commit 8fd43c6

Please sign in to comment.