From c308dad7858499be5a72644c868ec0de8bf5682b Mon Sep 17 00:00:00 2001 From: mokshadharma <118926161+mokshadharma@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:47:44 -0500 Subject: [PATCH 1/3] Can now create a draft release --- create-release.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/create-release.sh b/create-release.sh index 98a480cb..10e456dd 100755 --- a/create-release.sh +++ b/create-release.sh @@ -5,6 +5,7 @@ json_file=tmp/create-release.json timestamp=$(date +%s) +draft="false" prerelease="false" generate_release_notes="true" @@ -13,9 +14,10 @@ jq -n \ --arg commitish "${base_branch}" \ --arg name "Release 1 ($timestamp)" \ --arg prerelease ${prerelease} \ + --arg draft ${draft} \ --arg generate_release_notes ${generate_release_notes} \ --arg body "The first and possibly last ever release." \ - '{tag_name : $tag, target_commitish: $commitish, name: $name, generate_release_notes: $generate_release_notes | test("true"), body: $body, prerelease: $prerelease | test("true")}' > ${json_file} + '{tag_name : $tag, target_commitish: $commitish, name: $name, generate_release_notes: $generate_release_notes | test("true"), body: $body, draft: $draft | test("true"), prerelease: $prerelease | test("true")}' > ${json_file} #cat $json_file | jq -r >&2 From 504f3c63dcbb4ebd009ac0962c6869f2b787991f Mon Sep 17 00:00:00 2001 From: mokshadharma <118926161+mokshadharma@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:49:17 -0500 Subject: [PATCH 2/3] Fixed doc URL --- create-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-release.sh b/create-release.sh index 10e456dd..85b225d2 100755 --- a/create-release.sh +++ b/create-release.sh @@ -1,6 +1,6 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/repos#create-a-release +# https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release # POST /repos/:owner/:repo/releases json_file=tmp/create-release.json From 23631729e8ae3d4c22b5f7d90f367c6b6e1946dc Mon Sep 17 00:00:00 2001 From: mokshadharma <118926161+mokshadharma@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:52:08 -0500 Subject: [PATCH 3/3] Added get-a-release-by-tag-name.sh --- get-a-release-by-tag-name.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 get-a-release-by-tag-name.sh diff --git a/get-a-release-by-tag-name.sh b/get-a-release-by-tag-name.sh new file mode 100755 index 00000000..e5c04242 --- /dev/null +++ b/get-a-release-by-tag-name.sh @@ -0,0 +1,20 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name +# GET /repos/{owner}/{repo}/releases/tags/{tag} + + +# If the script is passed an argument $1 use that as the name +if [ -z "$1" ] + then + tag=$tag + else + tag=$1 +fi + + +curl ${curl_custom_flags} \ + -H "X-GitHub-Api-Version: ${github_api_version}" \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/repos/${owner}/${repo}/releases/tags/${tag}"