From fe4c6e5ef0329aff4432126b35b56e407ac4f8f1 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sun, 12 May 2024 10:18:32 +0200 Subject: [PATCH] add CI workflows --- .github/dependabot.yml | 23 +++++++++++++++++++++ .github/labeler.yml | 14 +++++++++++++ .github/release.yml | 22 ++++++++++++++++++++ .github/workflows/create-release.yml | 15 ++++++++++++++ .github/workflows/generate-labels.yml | 14 +++++++++++++ .github/workflows/merge-dependencies.yml | 26 ++++++++++++++++++++++++ .github/workflows/run-tests.yml | 17 ++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/generate-labels.yml create mode 100644 .github/workflows/merge-dependencies.yml create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f0c0bc3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,23 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + day: 'tuesday' + interval: 'monthly' + time: '02:00' + timezone: 'Europe/Berlin' + - package-ecosystem: 'npm' + directory: '/' + schedule: + day: 'tuesday' + interval: 'monthly' + time: '02:00' + timezone: 'Europe/Berlin' + pull-request-branch-name: + separator: '-' + open-pull-requests-limit: 99 + target-branch: 'main' + commit-message: + prefix: 'chore' + include: 'scope' diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..b7bf2b2 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,14 @@ +'type: bug(fix) ๐Ÿž': + title: '^fix(\(.+\))?:.*' +'type: chore ๐Ÿงน': + title: '^chore(\(.+\))?:.*' +'type: docs ๐Ÿ“‹': + title: '^docs(\(.+\))?:.*' +'type: feature โœจ': + title: '^feat(\(.+\))?:.*' +'type: refactor ๐Ÿ”ง': + title: '^refactor(\(.+\))?:.*' +'type: style ๐ŸŽจ': + title: '^style(\(.+\))?:.*' +'type: test ๐Ÿงช': + title: '^test(\(.+\))?:.*' diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..d2db194 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,22 @@ +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#example-configuration +changelog: + exclude: + authors: + - 'dependabot' + categories: + - title: 'New' + labels: + - 'type: feature โœจ' + - title: 'Improved' + labels: + - 'type: docs ๐Ÿ“‹' + - 'type: style ๐ŸŽจ' + - title: 'Fixed' + labels: + - 'type: bug(fix) ๐Ÿž' + - title: 'Documentation' + labels: + - 'type: docs ๐Ÿ“‹' + - title: 'Other Changes' + labels: + - '*' diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..2fb2561 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,15 @@ +name: 'Create Release' + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: 'Create Release' + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/.github/workflows/generate-labels.yml b/.github/workflows/generate-labels.yml new file mode 100644 index 0000000..5a2d061 --- /dev/null +++ b/.github/workflows/generate-labels.yml @@ -0,0 +1,14 @@ +name: 'Generate Labels' + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + label: + name: 'Label PR based on title' + runs-on: ubuntu-latest + steps: + - uses: srvaroa/labeler@v1.4 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/merge-dependencies.yml b/.github/workflows/merge-dependencies.yml new file mode 100644 index 0000000..980899b --- /dev/null +++ b/.github/workflows/merge-dependencies.yml @@ -0,0 +1,26 @@ +name: 'Merge Dependencies' + +# https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/ +on: [pull_request_target] + +permissions: + pull-requests: write + contents: write + +jobs: + auto-merge: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} + steps: + # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request#about-auto-merge + - name: 'Enable auto-merge on PR' + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: 'Approve PR' + 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/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..e79222d --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,17 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test-coverage: + uses: bennycode/actions/.github/workflows/test-coverage.yml@main + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}