Something went wrong. Try again.
Data management tools for playing BattleTech
Something went wrong. Try again.
Shell
12345678910111213141516171819202122#!/usr/bin/env bash# Print the ref a build is named after: <branch>-<sha12>, plus -dirty when the# tree has uncommitted changes. Slashes and anything else awkward in an S3# prefix become dashes; a detached HEAD contributes no branch. Callers may set# BUILD_REF instead.## The same shape headquarters and arena name their artifacts with, on purpose:# what is deployed is one id per repo, and reading three of them in# releases.auto.tfvars.json should not mean learning three conventions.set -euo pipefail
ref=$(git rev-parse --short=12 HEAD)branch=$(git rev-parse --abbrev-ref HEAD)if [ "$branch" != HEAD ]; then ref="$(printf '%s' "$branch" | tr -c 'A-Za-z0-9_.-' '-')-$ref"fiif [ -n "$(git status --porcelain)" ]; then ref="$ref-dirty" echo "working tree is dirty; ref is $ref" >&2fiprintf '%s\n' "$ref"