diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4dcf445 --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..35bb510 --- /dev/null +++ b/.github/workflows/master.yml @@ -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 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..7b52b1a --- /dev/null +++ b/.github/workflows/pr.yml @@ -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 }}