Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bastosmichael
Last active November 22, 2023 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastosmichael/fdd6bb1d177098cb1ecc7b70cf9cccfa to your computer and use it in GitHub Desktop.
Save bastosmichael/fdd6bb1d177098cb1ecc7b70cf9cccfa to your computer and use it in GitHub Desktop.
Node Dependabot Auto-merging based on pass/fail PR CI
version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
open-pull-requests-limit: 25
schedule:
interval: 'daily'
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/' # Location of package manifests
open-pull-requests-limit: 25
schedule:
interval: 'daily'
name: Continous Integration
on:
pull_request:
permissions:
pull-requests: write
contents: write
jobs:
build:
name: 'Build 📦'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
**/public
**/.cache
key: cache
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run build --if-present
- run: npm run test
dependabot:
name: 'Dependabot'
needs: [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.3.6
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
name: Continous Integration
on:
pull_request:
permissions:
pull-requests: write
contents: write
jobs:
build:
name: 'Build 📦'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
**/public
**/.cache
key: cache
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
# - name: Run install
# uses: borales/actions-yarn@v4
# with:
# cmd: install # will run `yarn install` command
# - name: Lint
# uses: borales/actions-yarn@v4
# with:
# cmd: lint
# - name: Build production bundle
# uses: borales/actions-yarn@v4
# with:
# cmd: build
# - name: Test
# uses: borales/actions-yarn@v4
# with:
# cmd: test
dependabot:
name: 'Dependabot'
needs: [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.3.6
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment