Skip to content

Commit 0f56f00

Browse files
authored
chore: add which-release script (#18657)
1 parent 695de6e commit 0f56f00

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/which-release.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy