Skip to content

Commit

Permalink
ci: dependabot auto-merge prs (#518)
Browse files Browse the repository at this point in the history
* ci: dependabot auto-merge prs

* chore: use node 16 to avoid storybook/webpack issues

webpack/webpack#14532
storybookjs/storybook#16555

* chore: explicit node version
  • Loading branch information
MauricioRobayo authored Mar 14, 2023
1 parent 96cf688 commit b17cc76
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: fix
prefix-development: chore
include: scope
25 changes: 25 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Dependabot auto-merge
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
auto-merge-dependabot-pr:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
- name: Enable auto-merge for patch and minor updates
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for major updates of development dependencies
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
54 changes: 36 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,53 @@
name: CI
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
jobs:
build:
build-and-test:
name: Build, lint, and test

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node
uses: actions/setup-node@v3
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 16.19.1
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm run test -- --ci --coverage

- name: Upload Code Coverage
uses: codecov/codecov-action@v2

- name: Codecov
run: npx codecov
- name: Build
run: npm run build

- name: Docs
run: npm run build-docs
- name: Upload build
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
release:
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.19.1
cache: npm
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.19.1

0 comments on commit b17cc76

Please sign in to comment.