Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(scripts): add fixtures.sh to add license to dev deployment#19374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 3 commits intomainfromcj/dogfood-license
Aug 18, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletionsscripts/fixtures.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
# shellcheck source=scripts/lib.sh
source "${SCRIPT_DIR}/lib.sh"

CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"

add_license() {
CODER_DEV_LICENSE="${CODER_DEV_LICENSE:-}"
if [[ -z "${CODER_DEV_LICENSE}" ]]; then
echo "No license provided. Please set CODER_DEV_LICENSE environment variable."
exit 1
fi

if [[ "${CODER_BUILD_AGPL:-0}" -gt "0" ]]; then
echo "Not adding a license in AGPL build mode."
exit 0
fi

NUM_LICENSES=$("${CODER_DEV_SHIM}" licenses list -o json | jq -r '. | length')
if [[ "${NUM_LICENSES}" -gt "0" ]]; then
echo "License already exists. Skipping addition."
exit 0
fi

echo -n "${CODER_DEV_LICENSE}" | "${CODER_DEV_SHIM}" licenses add -f - || {
echo "ERROR: failed to add license. Try adding one manually."
exit 1
}

exit 0
}

main() {
if [[ $# -eq 0 ]]; then
echo "Available fixtures:"
echo " license: adds the license from CODER_DEV_LICENSE"
exit 0
fi

[[ -n "${VERBOSE:-}" ]] && set -x
set -euo pipefail

case "$1" in
"license")
add_license
;;
*)
echo "Unknown fixture: $1"
exit 1
;;
esac
}

main "$@"
Loading

[8]ページ先頭

©2009-2025 Movatter.jp