From 3c4a96b910de3a040c2548b9676a0127aae2c7ff Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Wed, 20 Nov 2024 06:01:43 -0500 Subject: [PATCH] Also do the title check if the release is named for testing Now that the case where the release is not named for testing but was not published (or was published but was marked back to draft) is tested, this commit uncomments the name-check case. That is to say that this makes it so a release named as being for testing, rather than being a "real" release, will trigger the discussion title check. That way, releases that exist just to test releasing are not inadvertently announced to discussion threads intended for notifying about actual releases. This check is done first, since it is the primary case for not announcing a release that is otherwise eligible to be announced, and because the log message for it makes more sense when both reasons to do the title check apply. At least for now, when the release name indicates the release is for testing, the draft status of the release is not retrieved or examined. (However, as a possible future direction, it might be worthwhile to check all three things -- release name, release draft status, and whether the discussion is titled indicating it is for testing -- and report them in the GitHub Actions workflow/job log, for all combinations.) --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4f06bc01d7..b76dd8c5f26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -429,6 +429,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Comment in a locked discussion that notifies about only `gitoxide` (e.g. not `gix-*`) releases. announce-release: runs-on: ubuntu-latest @@ -463,13 +464,12 @@ jobs: echo "DISCUSSION_ID=$id" >> "$GITHUB_ENV" - # FIXME: Uncomment name-checking case, after testing the draft-checking case! - name: Avoid announcing a test in a non-test thread run: | case "$VERSION" in - # TEST-* | *-DO-NOT-USE ) # NOTE: Should be the same pattern as in `create-release` above. - # echo "The release name indicates testing, so we'll only post if the thread is for that." - # ;; + TEST-* | *-DO-NOT-USE ) # NOTE: Should be the same pattern as in `create-release` above. + echo "The release name indicates testing, so we'll only post if the thread is for that." + ;; * ) is_draft="$(gh release --repo="$REPOSITORY" view "$VERSION" --json isDraft --jq .isDraft)" if [ "$is_draft" = false ]; then