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
id: badge
if: ${{ always() && steps.coverage.outcome == 'success' && steps.coverage-files.outputs.exists == 'true' }}
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
with:
coverage-profile: coverage.out
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
run: |
set -euo pipefail
total="$(go tool cover -func=coverage.out | awk '/^total:/ {sub(/%/, "", $3); print $3}')"
if [[ -z "$total" ]]; then
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
if: ${{ always() }}

View File

@@ -12,43 +12,7 @@ concurrency:
cancel-in-progress: true
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:
needs: check-open-pr
if: ${{ needs.check-open-pr.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
container: docker.io/catthehacker/ubuntu:act-latest
defaults:
@@ -198,19 +162,27 @@ jobs:
exit 1
fi
- name: Publish coverage artefacts
id: coverage-badge
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
with:
coverage-profile: coverage.out
coverage-html: coverage.html
coverage-badge: coverage-badge.svg
coverage-summary: coverage-summary.json
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
branch-name: ${{ github.ref_name }}
repository-name: ${{ github.repository }}
summary-file: ${{ env.SUMMARY_FILE }}
- name: Add coverage summary
if: ${{ always() && steps.coverage-tests.outcome == 'success' }}
run: |
set -euo pipefail
total="${{ steps.coverage-tests.outputs.total }}"
if [[ -z "$total" ]]; then
total="n/a"
fi
{
echo '## Coverage'
echo
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
if: ${{ github.ref == 'refs/heads/main' }}