diff --git a/.github/workflows/after-merge-dependabot.yml b/.github/workflows/after-merge-dependabot.yml new file mode 100644 index 0000000..89f10de --- /dev/null +++ b/.github/workflows/after-merge-dependabot.yml @@ -0,0 +1,60 @@ +name: after-merge-dependabot + +on: + pull_request_target: + types: [closed] + +permissions: + contents: read + +jobs: + check: + if: github.event.pull_request.merged && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + concurrency: + group: dependabot-after-merge + cancel-in-progress: true + steps: + - name: Fetch dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - uses: oprypin/find-latest-tag@v1 + id: octokit + with: + repository: ${{ github.repository }} + prefix: v + + - name: Parse last release + id: semver_parser + uses: booxmedialtd/ws-action-parse-semver@v1 + with: + input_string: '${{ steps.octokit.outputs.tag }}' + version_extractor_regex: 'v(.*)$' + + - name: Compute tag + id: compte_tag + run: | + major=${{ steps.semver_parser.outputs.major }} + minor=${{ steps.semver_parser.outputs.minor }} + patch=${{ steps.semver_parser.outputs.patch }} + if [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-minor" ]; then + minor=$((minor+1)) + patch=0 + echo "::warning::bumping minor version" + elif [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-patch" ]; then + patch=$((patch+1)) + echo "::warning::bumping patch version" + fi + tag="v${major}.${minor}.${patch}" + echo "::set-output name=tag::${tag}" + echo "::warning::tag == ${tag}" + + - name: Create tag + uses: tvdias/github-tagger@v0.0.2 + if: steps.compte_tag.outputs.tag != steps.semver_parser.outputs.fullversion + with: + repo-token: "${{ secrets.AUTO_MERGE_TOKEN }}" + tag: "${{ steps.compte_tag.outputs.tag }}" \ No newline at end of file diff --git a/.github/workflows/auto-accept-dependabot.yml b/.github/workflows/auto-accept-dependabot.yml new file mode 100644 index 0000000..3caf532 --- /dev/null +++ b/.github/workflows/auto-accept-dependabot.yml @@ -0,0 +1,22 @@ +name: auto-accept-dependabot + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: write + pull-requests: write + +jobs: + auto-merge: + if: github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + - name: Approve and Enable Auto-Merge + run: | + gh pr review --approve "$PR_URL" + gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 577062f..273b42d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,22 +1,30 @@ -name: linter +name: golangci-lint +on: + push: + branches: + - main + - master + pull_request: -on: push +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read jobs: - linter: + golangci: + name: lint runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - fetch-depth: 0 - - - name: set up go - uses: actions/setup-go@v5 - with: - go-version: "1.25" - + go-version: '>=1.26' - name: golangci-lint uses: golangci/golangci-lint-action@v7 with: version: latest + args: > + --enable govet + --enable staticcheck + --enable unused diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 768ce3b..0f27c7b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -16,7 +16,7 @@ jobs: - name: set up go uses: actions/setup-go@v5 with: - go-version: 1.25 + go-version: ">=1.26" - name: cache go modules uses: actions/cache@v4