Skip to content

Commit

Permalink
.github: Fix the repatriation logic to deal with merged/closed PRs
Browse files Browse the repository at this point in the history
If there's an old PR that's already been merged, that means we should be
creating a new one, rather than assuming that pushing to the branch will
update the old one.

As seen on https://github.com/emissary-ingress/emissary/runs/6523998225

Signed-off-by: Luke Shumaker <[email protected]>
  • Loading branch information
LukeShu committed May 20, 2022
1 parent f4d2459 commit d62b212
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/repatriate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ jobs:
git push --set-upstream origin "$merge_branch"
fi
if url=$(gh pr view --json=url --jq=.url); then
url=$(gh pr list --limit=1 --head="$merge_branch" --state=open --json=url --jq='.[0].url')
if [[ -n "$url" ]]; then
echo "::set-output name=verb::Updated"
else
gh pr create \
--title="[${next_ver}] Repatriate from ${this_ver}" \
--body="This PR merges ${this_branch} in to ${next_branch}." \
--base="$next_branch"
url=$(gh pr view --json=url --jq=.url)
url=$(gh pr list --limit=1 --head="$merge_branch" --state=open --json=url --jq='.[0].url')
echo "::set-output name=verb::Created"
fi
echo "::set-output name=pr_url::${url}"
Expand Down

0 comments on commit d62b212

Please sign in to comment.