Skip to content

chore: update file coverage.yml #22

chore: update file coverage.yml

chore: update file coverage.yml #22

Workflow file for this run

name: Update Badge
on:
push:
branches:
- '*'
- '!badges'
jobs:
test:
runs-on: ubuntu-latest
name: A job to test this action
steps:
# Get current branch name to use it as destination directory
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
id: extract_branch
- name: Prepare environment
id: coverage
run: |
# Generates a GitHub Workflow output named `lines` with a coverage value
echo "lines=${COVERAGE}" >> $GITHUB_ENV
# Output values to be used by other steps
echo "path=${BADGE_PATH}" >> $GITHUB_ENV
echo "branch=${BRANCH}" >> $GITHUB_ENV
env:
COVERAGE: 53.5%
BADGE_PATH: badges/test-badge.svg
BRANCH: badges
- uses: actions/checkout@v4
with:
ref: ${{ env.branch }}
# Create the directory where badges will be saved, if needed
- name: Create destination directory
run: mkdir -p "${{ env.BADGE_PATH%/* }}"

Check failure on line 41 in .github/workflows/coverage.yml

View workflow run for this annotation

GitHub Actions / Update Badge

Invalid workflow file

The workflow is not valid. .github/workflows/coverage.yml (Line: 41, Col: 14): Unexpected symbol: 'BADGE_PATH%/*'. Located at position 5 within expression: env.BADGE_PATH%/*
# Use the output from the `coverage` step
- name: Generate the badge SVG image
uses: emibcn/badge-action@v2.0.3
id: badge
with:
label: 'Test coverage'
status: ${{ env.COVERAGE }}
color: 'blue,555,daf'
path: ${{ env.BADGE_PATH }}
- name: Upload badge as artifact
uses: actions/upload-artifact@v4
with:
name: badge
path: ${{ env.BADGE_PATH }}
if-no-files-found: error
- name: Commit badge
continue-on-error: true
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add "${{ env.BADGE_PATH }}"
git commit -m "Add/Update badge" || echo "No changes to commit"
- name: Push badge commit
uses: ad-m/github-push-action@master
if: ${{ success() }}
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: ${{ env.BRANCH }}