From e6e0f34487ff09b0f8413e59bafd4a142bcaea2f Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Mon, 30 Jun 2025 10:59:53 +0200 Subject: [PATCH 1/3] chore: add which-release script Signed-off-by: Danny Kopping --- scripts/which-release.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/which-release.sh diff --git a/scripts/which-release.sh b/scripts/which-release.sh new file mode 100755 index 0000000000000..9d475342a085b --- /dev/null +++ b/scripts/which-release.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +COMMIT=$1 +if [[ -z "${COMMIT}" ]]; then + echo "Usage: $0 " + echo "" + echo -n "Example: $0 " + echo $'$(gh pr view --json mergeCommit | jq \'.mergeCommit.oid\' -r)' + exit 2 +fi + +REMOTE=$(git remote -v | grep coder/coder | awk '{print $1}' | head -n1) +if [[ -z "${REMOTE}" ]]; then + echo "Could not find remote for coder/coder" + exit 1 +fi + +echo "It is recommended that you run \`git fetch -ap ${REMOTE}\` to ensure you get a correct result." + +RELEASES=$(git branch -r --contains "${COMMIT}" | grep "${REMOTE}" | grep "/release/" | sed "s|${REMOTE}/||") +if [[ -z "${RELEASES}" ]]; then + echo "Commit was not found in any release branch" +else + echo "Commit was found in the following release branches:" + echo "${RELEASES}" +fi From dcacc89f95e2639c073c05ca67abb2091da7745d Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Mon, 30 Jun 2025 11:19:39 +0200 Subject: [PATCH 2/3] chore: make fmt Signed-off-by: Danny Kopping --- scripts/which-release.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/which-release.sh b/scripts/which-release.sh index 9d475342a085b..082f4114f2be8 100755 --- a/scripts/which-release.sh +++ b/scripts/which-release.sh @@ -2,25 +2,25 @@ COMMIT=$1 if [[ -z "${COMMIT}" ]]; then - echo "Usage: $0 " - echo "" - echo -n "Example: $0 " - echo $'$(gh pr view --json mergeCommit | jq \'.mergeCommit.oid\' -r)' - exit 2 + echo "Usage: $0 " + echo "" + echo -n "Example: $0 " + echo $'$(gh pr view --json mergeCommit | jq \'.mergeCommit.oid\' -r)' + exit 2 fi REMOTE=$(git remote -v | grep coder/coder | awk '{print $1}' | head -n1) if [[ -z "${REMOTE}" ]]; then - echo "Could not find remote for coder/coder" - exit 1 + echo "Could not find remote for coder/coder" + exit 1 fi echo "It is recommended that you run \`git fetch -ap ${REMOTE}\` to ensure you get a correct result." RELEASES=$(git branch -r --contains "${COMMIT}" | grep "${REMOTE}" | grep "/release/" | sed "s|${REMOTE}/||") if [[ -z "${RELEASES}" ]]; then - echo "Commit was not found in any release branch" + echo "Commit was not found in any release branch" else - echo "Commit was found in the following release branches:" - echo "${RELEASES}" + echo "Commit was found in the following release branches:" + echo "${RELEASES}" fi From 617f43e783301f1d75748e207d5f4badf933f0e9 Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Tue, 1 Jul 2025 09:54:19 +0200 Subject: [PATCH 3/3] chore: review comments Signed-off-by: Danny Kopping --- scripts/which-release.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/which-release.sh b/scripts/which-release.sh index 082f4114f2be8..14c2c138c1ed0 100755 --- a/scripts/which-release.sh +++ b/scripts/which-release.sh @@ -1,26 +1,30 @@ #!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/lib.sh +source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" + COMMIT=$1 if [[ -z "${COMMIT}" ]]; then - echo "Usage: $0 " - echo "" - echo -n "Example: $0 " - echo $'$(gh pr view --json mergeCommit | jq \'.mergeCommit.oid\' -r)' + log "Usage: $0 " + log "" + log -n "Example: $0 " + log $'$(gh pr view --json mergeCommit | jq \'.mergeCommit.oid\' -r)' exit 2 fi REMOTE=$(git remote -v | grep coder/coder | awk '{print $1}' | head -n1) if [[ -z "${REMOTE}" ]]; then - echo "Could not find remote for coder/coder" - exit 1 + error "Could not find remote for coder/coder" fi -echo "It is recommended that you run \`git fetch -ap ${REMOTE}\` to ensure you get a correct result." +log "It is recommended that you run \`git fetch -ap ${REMOTE}\` to ensure you get a correct result." -RELEASES=$(git branch -r --contains "${COMMIT}" | grep "${REMOTE}" | grep "/release/" | sed "s|${REMOTE}/||") +RELEASES=$(git branch -r --contains "${COMMIT}" | grep "${REMOTE}" | grep "/release/" | sed "s|${REMOTE}/||" || true) if [[ -z "${RELEASES}" ]]; then - echo "Commit was not found in any release branch" + log "Commit was not found in any release branch" else - echo "Commit was found in the following release branches:" - echo "${RELEASES}" + log "Commit was found in the following release branches:" + log "${RELEASES}" fi 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