Skip to content

Merge pull request #1 from abdullahbayram/ci/post-merge-coverage-fall… #4

Merge pull request #1 from abdullahbayram/ci/post-merge-coverage-fall…

Merge pull request #1 from abdullahbayram/ci/post-merge-coverage-fall… #4

Workflow file for this run

name: CI Workflow
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
validate-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22.2.0
- name: Install dependencies
run: npm install
- name: Validate PR
run: npm run validate:pr
post-merge-assets:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22.2.0
- name: Install dependencies
run: npm install
- name: Check and Generate Coverage
run: |
if [ ! -f ./coverage/coverage-summary.json ]; then
echo "Coverage summary not found. Running tests to generate it..."
npm run test:coverage
else
echo "Coverage summary found. Proceeding..."
fi
- name: Generate Coverage Assets
run: npm run generate-coverage-assets
- name: Commit and Push Coverage Assets
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add badges/*.svg badges/coverage-summary.png
git commit -m "chore: update coverage badges and summary" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}