discourse-release: announce a given tag, for releases made by the job's own token
Gitea starts no workflow for events caused by the Actions bot, so a release created with GITHUB_TOKEN never fires 'on: release'. With 'tag:' the action fetches that release itself; drafts are skipped.
This commit is contained in:
1 parent
3df56d16a5
commit
1f0c7971d6
3 files changed
+36
No files matched your search
@@ -10,6 +10,19 @@ if [ -z "$category_path" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${TAG:-}" ]; then
|
||||
# Called with a tag (a release made by the job's own token): fetch it and
|
||||
# treat it as the event, so everything below is the same either way.
|
||||
base="${CI_SERVER_INTERNAL:-$GITHUB_SERVER_URL}"
|
||||
EVENT_PATH=$(mktemp)
|
||||
curl -fsS -H "Authorization: token $GITEA_TOKEN" "$base/api/v1/repos/$REPO/releases/tags/$TAG" |
|
||||
jq '{release: .}' > "$EVENT_PATH"
|
||||
fi
|
||||
if [ "$(jq -r '.release.draft // false' "$EVENT_PATH")" = true ]; then
|
||||
echo "release is a draft; not announcing"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tag=$(jq -r '.release.tag_name' "$EVENT_PATH")
|
||||
# The category id, looked up anonymously (the category is public); the
|
||||
# release-bot key is scoped to creating posts and nothing else.
|
||||
|
||||
Reference in new issue
Block a user