ci: remove fragile external badge actions

This commit is contained in:
Micheal Wilkinson
2026-03-21 23:15:32 +00:00
parent ced23e0156
commit d63a8bb615
2 changed files with 30 additions and 54 deletions

View File

@@ -168,11 +168,15 @@ jobs:
- name: Upload coverage badge - name: Upload coverage badge
id: badge id: badge
if: ${{ always() && steps.coverage.outcome == 'success' && steps.coverage-files.outputs.exists == 'true' }} if: ${{ always() && steps.coverage.outcome == 'success' && steps.coverage-files.outputs.exists == 'true' }}
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0 run: |
with: set -euo pipefail
coverage-profile: coverage.out total="$(go tool cover -func=coverage.out | awk '/^total:/ {sub(/%/, "", $3); print $3}')"
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }} if [[ -z "$total" ]]; then
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }} total="n/a"
fi
echo "total=${total}" >> "$GITHUB_OUTPUT"
echo "report-url=n/a" >> "$GITHUB_OUTPUT"
echo "badge-url=n/a" >> "$GITHUB_OUTPUT"
- name: Validate changelog gate - name: Validate changelog gate
if: ${{ always() }} if: ${{ always() }}

View File

@@ -12,43 +12,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
check-open-pr:
runs-on: ubuntu-latest
container: docker.io/catthehacker/ubuntu:act-latest
outputs:
should_run: ${{ steps.detect.outputs.should_run }}
steps:
- name: Detect open PR for branch
id: detect
env:
REPOSITORY: ${{ github.repository }}
OWNER: ${{ github.repository_owner }}
BRANCH: ${{ github.ref_name }}
SERVER_URL: ${{ github.server_url }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
api_url="${SERVER_URL}/api/v1/repos/${REPOSITORY}/pulls?state=open&head=${OWNER}:${BRANCH}"
if [ -n "${TOKEN:-}" ]; then
response="$(curl -fsSL -H "Authorization: token ${TOKEN}" -H "accept: application/json" "$api_url" || echo '[]')"
else
response="$(curl -fsSL -H "accept: application/json" "$api_url" || echo '[]')"
fi
open_prs="$(printf '%s' "$response" | grep -o '"number":[0-9]\+' | wc -l | tr -d ' ')"
if [ "$open_prs" -gt 0 ]; then
echo "should_run=false" >> "$GITHUB_OUTPUT"
echo "Open PR detected for ${OWNER}:${BRANCH}; skipping push validation." >> "$GITHUB_STEP_SUMMARY"
else
echo "should_run=true" >> "$GITHUB_OUTPUT"
echo "No open PR detected for ${OWNER}:${BRANCH}; running push validation." >> "$GITHUB_STEP_SUMMARY"
fi
validate: validate:
needs: check-open-pr
if: ${{ needs.check-open-pr.outputs.should_run == 'true' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: docker.io/catthehacker/ubuntu:act-latest container: docker.io/catthehacker/ubuntu:act-latest
defaults: defaults:
@@ -198,19 +162,27 @@ jobs:
exit 1 exit 1
fi fi
- name: Publish coverage artefacts - name: Add coverage summary
id: coverage-badge if: ${{ always() && steps.coverage-tests.outcome == 'success' }}
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0 run: |
with: set -euo pipefail
coverage-profile: coverage.out total="${{ steps.coverage-tests.outputs.total }}"
coverage-html: coverage.html if [[ -z "$total" ]]; then
coverage-badge: coverage-badge.svg total="n/a"
coverage-summary: coverage-summary.json fi
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }} {
branch-name: ${{ github.ref_name }} echo '## Coverage'
repository-name: ${{ github.repository }} echo
summary-file: ${{ env.SUMMARY_FILE }} echo "- Total: ${total}%"
echo
echo '### Package Coverage'
if [[ -f coverage-packages.md ]]; then
cat coverage-packages.md
else
echo '_Package coverage details unavailable for this run._'
fi
} >> "$SUMMARY_FILE"
- name: Run behavior suite on main pushes - name: Run behavior suite on main pushes
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}