chore(go): compose vociferate runtime flow

This commit is contained in:
Micheal Wilkinson
2026-03-21 14:45:50 +00:00
parent 9a91c70e5d
commit f04df719e2
11 changed files with 537 additions and 510 deletions

View File

@@ -147,103 +147,28 @@ runs:
-H "Content-Type: application/json" \
"$comments_url" >/dev/null
- name: Resolve vociferate binary metadata
id: resolve-binary
- name: Detect changelog file
id: changelog-file
shell: bash
env:
ACTION_REF: ${{ github.action_ref }}
ACTION_REPOSITORY: ${{ github.action_repository }}
CACHE_TOKEN: ${{ env.VOCIFERATE_CACHE_TOKEN }}
SERVER_URL: ${{ github.server_url }}
RUNNER_ARCH: ${{ runner.arch }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
bash "$GITHUB_ACTION_PATH/../script/resolve-vociferate-runtime.sh"
- name: Setup Go
if: steps.resolve-binary.outputs.use_binary != 'true'
uses: actions/setup-go@v5
with:
go-version: '1.26.1'
cache: true
cache-dependency-path: ${{ steps.resolve-binary.outputs.source_root }}/go.sum
- name: Restore cached vociferate binary
id: cache-vociferate
if: steps.resolve-binary.outputs.use_binary == 'true'
uses: actions/cache@v4
with:
path: ${{ steps.resolve-binary.outputs.cache_dir }}
key: vociferate-${{ steps.resolve-binary.outputs.cache_token }}-linux-${{ runner.arch }}
- name: Download vociferate binary
if: steps.resolve-binary.outputs.use_binary == 'true' && steps.cache-vociferate.outputs.cache-hit != 'true'
shell: bash
env:
TOKEN: ${{ github.token }}
ASSET_URL: ${{ steps.resolve-binary.outputs.asset_url }}
BINARY_PATH: ${{ steps.resolve-binary.outputs.binary_path }}
run: |
bash "${{ steps.resolve-binary.outputs.source_root }}/script/download-vociferate-binary.sh"
- name: Extract changelog unreleased entries from binary
id: extract-changelog-binary
if: steps.resolve-binary.outputs.use_binary == 'true'
shell: bash
env:
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
CHANGELOG: ${{ inputs.changelog }}
run: |
set -euo pipefail
if [[ ! -f "$CHANGELOG" ]]; then
printf 'unreleased_entries=%s\n' "" >> "$GITHUB_OUTPUT"
exit 0
fi
delimiter="EOF_CHANGELOG"
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
"$VOCIFERATE_BIN" --print-unreleased --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
- name: Extract changelog unreleased entries from source
id: extract-changelog-source
if: steps.resolve-binary.outputs.use_binary != 'true'
shell: bash
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
env:
CHANGELOG: ${{ inputs.changelog }}
run: |
set -euo pipefail
if [[ ! -f "$CHANGELOG" ]]; then
printf 'unreleased_entries=%s\n' "" >> "$GITHUB_OUTPUT"
exit 0
printf 'exists=false\n' >> "$GITHUB_OUTPUT"
else
printf 'exists=true\n' >> "$GITHUB_OUTPUT"
fi
delimiter="EOF_CHANGELOG"
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
go run ./cmd/vociferate --print-unreleased --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
- name: Finalize changelog extraction
- name: Extract changelog unreleased entries
id: extract-changelog
shell: bash
env:
UNRELEASED_BINARY: ${{ steps.extract-changelog-binary.outputs.unreleased_entries }}
UNRELEASED_SOURCE: ${{ steps.extract-changelog-source.outputs.unreleased_entries }}
run: |
set -euo pipefail
unreleased="$UNRELEASED_BINARY"
if [[ -z "$unreleased" ]]; then
unreleased="$UNRELEASED_SOURCE"
fi
delimiter="EOF_CHANGELOG"
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
printf '%s\n' "$unreleased" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
if: steps.changelog-file.outputs.exists == 'true'
uses: ../run-vociferate
with:
root: ${{ github.workspace }}
changelog: ${{ inputs.changelog }}
print-unreleased: 'true'
- name: Validate changelog gate
id: changelog-gate
@@ -402,7 +327,7 @@ runs:
COMMENT_TITLE: ${{ inputs.comment-title }}
COVERAGE_PCT: ${{ inputs.coverage-percentage }}
BADGE_URL: ${{ inputs.badge-url }}
UNRELEASED: ${{ steps.extract-changelog.outputs.unreleased_entries }}
UNRELEASED: ${{ steps.extract-changelog.outputs.stdout }}
GATE_ENABLED: ${{ steps.changelog-gate.outputs.gate_enabled }}
GATE_PASSED: ${{ steps.changelog-gate.outputs.gate_passed }}
GATE_MODE: ${{ inputs.changelog-gate-mode }}