Skip to content

feat: add workflows PR & master #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: feat
prefix-development: feat
open-pull-requests-limit: 99
40 changes: 40 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Master

on:
push:
branches: ["master"]

permissions:
contents: write
id-token: write

jobs:
linting:
name: linting
runs-on: ubuntu-latest
environment: testing
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: format
run: npm run format
- name: lint
run: npm run lint
- name: prettify
run: npm run pret

test:
name: Test
runs-on: ubuntu-22.04
environment: testing
steps:
- name: 👌🏻 Checkout
uses: actions/checkout@v3
- name: 👌🏻 Setup and build
run: |
npm ci
npm run build
- name: 🔎 Run tests
run: npm run test --if-present
72 changes: 72 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: PR

on:
pull_request:
types:
- opened
- edited
- synchronize

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
linting:
name: linting
runs-on: ubuntu-latest
environment: testing
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: format
run: npm run format
- name: lint
run: npm run lint
- name: prettify
run: npm run pret

test:
name: Test
runs-on: ubuntu-22.04
environment: testing
steps:
- name: 👌🏻 Checkout
uses: actions/checkout@v3
- name: 👌🏻 Setup and build
run: |
npm ci
npm run build
- name: 🔎 Run tests
run: npm run test --if-present

set-automerge:
name: Approve and automerge (only dependanbot PRs)
runs-on: ubuntu-latest
environment: testing
needs: [test, linting]
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
if:
${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}