|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +# shellcheck source=scripts/lib.sh |
| 6 | +source"$(dirname"${BASH_SOURCE[0]}")/lib.sh" |
| 7 | + |
| 8 | +COMMIT=$1 |
| 9 | +if [[-z"${COMMIT}" ]];then |
| 10 | +log"Usage:$0 <commit-ref>" |
| 11 | +log"" |
| 12 | +log -n"Example:$0" |
| 13 | +log$'$(gh pr view <pr-num> --json mergeCommit | jq\'.mergeCommit.oid\' -r)' |
| 14 | +exit 2 |
| 15 | +fi |
| 16 | + |
| 17 | +REMOTE=$(git remote -v| grep coder/coder| awk'{print $1}'| head -n1) |
| 18 | +if [[-z"${REMOTE}" ]];then |
| 19 | +error"Could not find remote for coder/coder" |
| 20 | +fi |
| 21 | + |
| 22 | +log"It is recommended that you run\`git fetch -ap${REMOTE}\` to ensure you get a correct result." |
| 23 | + |
| 24 | +RELEASES=$(git branch -r --contains"${COMMIT}"| grep"${REMOTE}"| grep"/release/"| sed"s|${REMOTE}/||"|| true) |
| 25 | +if [[-z"${RELEASES}" ]];then |
| 26 | +log"Commit was not found in any release branch" |
| 27 | +else |
| 28 | +log"Commit was found in the following release branches:" |
| 29 | +log"${RELEASES}" |
| 30 | +fi |