Last active
October 3, 2024 13:07
-
-
Save bastosmichael/fdd6bb1d177098cb1ecc7b70cf9cccfa to your computer and use it in GitHub Desktop.
Node Dependabot Auto-merging based on pass/fail PR CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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