Skip to content

autotag-from-changelog: Add tag-created and tag outputs#19

Open
fantapop wants to merge 1 commit intocockroachdb:mainfrom
fantapop:autotag-outputs
Open

autotag-from-changelog: Add tag-created and tag outputs#19
fantapop wants to merge 1 commit intocockroachdb:mainfrom
fantapop:autotag-outputs

Conversation

@fantapop
Copy link
Copy Markdown
Contributor

Callers can now check whether a new tag was pushed and what it was, enabling downstream steps like release notifications or artifact builds.

Callers can now check whether a new tag was pushed and what it was,
enabling downstream steps like release notifications or artifact builds.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GitHub Action outputs to autotag-from-changelog so callers can detect whether a tag was created and which tag it was, enabling downstream release/build steps.

Changes:

  • Add tag-created and tag outputs to the autotag-from-changelog composite action and emit them from auto-tag-release.sh.
  • Extend integration tests to assert step outputs via a new expect_output helper.
  • Document the new outputs in CHANGELOG.md (and a small docs addition in CLAUDE.md).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test_helpers.sh Adds expect_output helper to assert values written to GITHUB_OUTPUT.
autotag-from-changelog/auto-tag-release_test.sh Exports GITHUB_OUTPUT and asserts tag-created / tag outputs in integration tests.
autotag-from-changelog/auto-tag-release.sh Writes tag-created/tag outputs on success/skip paths.
autotag-from-changelog/action.yml Declares composite action outputs and wires them to the step outputs.
CLAUDE.md Adds commit message guidance.
CHANGELOG.md Notes newly exposed action outputs and the new test helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

outputs:
tag-created:
description: Whether a new tag was created ("true" or "false")
value: ${{ steps.autotag.outputs.tag-created }}
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag-created contains a hyphen, so steps.autotag.outputs.tag-created will be parsed as an expression using subtraction rather than an output lookup. Use bracket notation for that output name (or rename the output to a hyphen-free name like tag_created to keep dot-notation consistent with the other actions in this repo).

Suggested change
value: ${{ steps.autotag.outputs.tag-created }}
value: ${{ steps.autotag.outputs['tag-created'] }}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just make this tag_created, the suggestion feels like an overkill

Comment on lines +104 to +114
expect_output() {
local name="$1" key="$2" expected="$3"
local actual
actual=$(grep --fixed-strings "${key}=" "${GITHUB_OUTPUT}" | tail -1 | cut -d= -f2-)
if [ "$actual" = "$expected" ]; then
echo "PASS: $name"
PASS=$((PASS + 1))
else
echo "FAIL: $name — expected output $key=$expected, got '$actual'"
FAIL=$((FAIL + 1))
fi
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect_output runs grep | tail | cut under set -euo pipefail (the test files enable this). If the key is missing or $GITHUB_OUTPUT doesn't exist, the pipeline will return non-zero and abort the entire test script instead of recording a FAIL. Consider explicitly handling the missing-key/missing-file case (e.g., check the file exists and make the pipeline non-fatal) so a mismatch increments FAIL like the other helpers.

Copilot uses AI. Check for mistakes.
Comment on lines +131 to +133
GITHUB_OUTPUT="$TMPDIR/github_output"
export GITHUB_OUTPUT

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration tests reuse a single $GITHUB_OUTPUT file across multiple runs, and expect_output checks the last occurrence of a key. This can cause false positives when a particular invocation fails to write an output at all (a prior run’s value may still be the “last” match). To make the assertions reliably tied to each invocation, truncate or replace $GITHUB_OUTPUT before each script run that you validate outputs for (or otherwise scope the grep to only new lines).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@linhcrl linhcrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the copilot comments, this looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants