Skip to content

Commit

Permalink
core(ci): update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
BrahimS committed Oct 3, 2024
1 parent 5f9ecef commit e0e2045
Showing 1 changed file with 52 additions and 17 deletions.
69 changes: 52 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,63 @@ name: CI
on:
push:
branches:
- main
- main
pull_request:

permissions:
actions: read
contents: read
branches:
- main

jobs:
main:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run test

# Cache node_modules
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build

- run: npm run lint
- run: npm run test
- run: npm run build
# Add a job to check for dependency updates
dependabot:
name: 'Dependabot'
needs: [lint, test, build]
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
if: ${{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}}

0 comments on commit e0e2045

Please sign in to comment.