From f9e2ca64a9aaab0d31d1bb496910153e352e2d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 4 Sep 2024 10:07:53 +0200 Subject: [PATCH] chore: setup dependabot and GHA CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/dependabot.yml | 33 +++++++++++++++++++ .github/workflows/ci.yml | 29 ++++++++++++++++ .../dependabot-auto-approve-always.yml | 26 +++++++++++++++ .../dependabot-auto-approve-minor.yml | 28 ++++++++++++++++ .github/workflows/dependabot-auto-merge.yml | 17 ++++++++++ 5 files changed, 133 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/dependabot-auto-approve-always.yml create mode 100644 .github/workflows/dependabot-auto-approve-minor.yml create mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ed53b3f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,33 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + versioning-strategy: increase + schedule: + interval: "daily" + time: "09:00" + timezone: "Europe/Berlin" + commit-message: + prefix: "deps" + prefix-development: "deps(dev)" + reviewers: + - "bajtos" + - "juliangruber" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + time: "09:00" + timezone: "Europe/Berlin" + commit-message: + prefix: "ci" + reviewers: + - "bajtos" + - "juliangruber" + - package-ecosystem: "docker" + directories: + - "/" + schedule: + interval: "daily" + time: "15:00" + timezone: "Europe/Berlin" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ce8bfc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-indexer: + runs-on: ubuntu-latest + env: + NPM_CONFIG_WORKSPACE: indexer + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + lint-all: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm run lint diff --git a/.github/workflows/dependabot-auto-approve-always.yml b/.github/workflows/dependabot-auto-approve-always.yml new file mode 100644 index 0000000..0a2dc2f --- /dev/null +++ b/.github/workflows/dependabot-auto-approve-always.yml @@ -0,0 +1,26 @@ +name: Dependabot auto-approve updates +on: pull_request + +permissions: + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + strategy: + matrix: + dependencyStartsWith: + - spark-evaluate + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + if: ${{startsWith(steps.metadata.outputs.dependency-names, matrix.dependencyStartsWith)}} + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/dependabot-auto-approve-minor.yml b/.github/workflows/dependabot-auto-approve-minor.yml new file mode 100644 index 0000000..062567d --- /dev/null +++ b/.github/workflows/dependabot-auto-approve-minor.yml @@ -0,0 +1,28 @@ +name: Dependabot auto-approve minor updates +on: pull_request + +permissions: + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + strategy: + matrix: + dependencyStartsWith: + - '@sentry/' + - standard + - typescript + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + if: ${{startsWith(steps.metadata.outputs.dependency-names, matrix.dependencyStartsWith) && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')}} + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 0000000..33b3d15 --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,17 @@ +name: Dependabot auto-merge +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}