diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59a9a88..38b8510 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,28 +2,28 @@ name: CI on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6.0.2 - + - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: '20' cache: 'npm' - + - name: Install dependencies run: npm ci - + - name: Run tests run: npm test - + - name: Check test coverage run: npm run test:coverage @@ -31,23 +31,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6.0.2 - + - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: '20' cache: 'npm' - + - name: Install dependencies run: npm ci - + - name: Build dist run: npm run build - + - name: Check if dist is up to date run: | if [ -n "$(git status --porcelain dist/)" ]; then echo "::error::dist/ is not up to date. Please run 'npm run build' and commit the changes." git diff dist/ exit 1 - fi \ No newline at end of file + fi diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index cba54c7..9797368 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -9,10 +9,36 @@ permissions: jobs: dependabot: runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Rebuild dist + run: npm run build + + - name: Commit and push changes + run: | + if [ -n "$(git status --porcelain dist/)" ]; then + git config --global user.name "dependabot[bot]" + git config --global user.email "49699333+dependabot[bot]@users.noreply.github.com" + git add dist/ + git commit -m "chore: rebuild dist" + git push + fi + - name: Enable auto-merge for Dependabot PRs - if: github.actor == 'dependabot[bot]' run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file + GH_TOKEN: ${{secrets.GITHUB_TOKEN}}