Skip to content

ci(deps): bump actions/upload-artifact from 4 to 7 (#49) #163

ci(deps): bump actions/upload-artifact from 4 to 7 (#49)

ci(deps): bump actions/upload-artifact from 4 to 7 (#49) #163

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x, 24.x] # Test against multiple Node.js versions; 24 is the default (LTS)
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm' # Cache npm dependencies
- name: Install dependencies
run: npm ci # Use ci for cleaner installs in CI environments
- name: Build TypeScript
run: npm run build
- name: Lint code (Optional, but recommended)
run: npm run lint
- name: Run tests
run: npm run test:coverage
# Upload coverage to Codecov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage/lcov.info
# fail_ci_if_error: false
# Optional: Upload coverage to Coveralls or Codecov
# - name: Upload coverage to Coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: ./coverage/lcov.info # Adjust if your lcov file is elsewhere
# Optional: Publish to NPM on new tag (example)
# - name: Publish to NPM
# if: startsWith(github.ref, 'refs/tags/v') # Only run on version tags (e.g., v1.0.0)
# run: |
# npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
# npm publish --access public
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Store your NPM token as a secret in GitHub
# Auto-approve Dependabot PRs for minor and patch updates
auto-approve:
needs: build-and-test
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
permissions:
pull-requests: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve PR
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Auto-merge Dependabot PRs for minor and patch updates
auto-merge:
needs: auto-approve
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}