From 20bdf37f7c09564eab99fd76fd38a1ac99e0213b Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Wed, 18 Sep 2024 20:26:15 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20error=20in=20runnin?= =?UTF-8?q?g=20make=20install-tools=20(#108)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .devcontainer/devcontainer.json | 6 +- .devcontainer/scripts/post-create.sh | 3 +- .devcontainer/scripts/setup-devcontainers.sh | 6 + .github/labeler.yml | 166 ++++++++++++++++++ .github/multi-labeler.yml | 139 +++++++-------- .github/release-drafter.yml | 169 +++++++++++-------- .github/release.yml | 90 ++++++---- .github/workflows/conventional-commits.yml | 57 ------- .github/workflows/first-interaction.yml | 26 --- .github/workflows/labeler.yml | 59 ++++--- .github/workflows/release-drafter.yml | 11 +- .vscode/settings.json | 3 +- scripts/install-tools.sh | 28 +-- scripts/lint.sh | 3 + 14 files changed, 456 insertions(+), 310 deletions(-) create mode 100644 .devcontainer/scripts/setup-devcontainers.sh create mode 100644 .github/labeler.yml delete mode 100644 .github/workflows/conventional-commits.yml delete mode 100644 .github/workflows/first-interaction.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d5f69803..5333e63f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -113,7 +113,11 @@ "GitHub.vscode-github-actions", "PKief.material-icon-theme", "EditorConfig.EditorConfig", - "DavidAnson.vscode-markdownlint" + "DavidAnson.vscode-markdownlint", + "redhat.vscode-yaml", + "kennylong.kubernetes-yaml-formatter", + "sonarsource.sonarlint-vscode", + "ms-vscode.makefile-tools" ] } }, diff --git a/.devcontainer/scripts/post-create.sh b/.devcontainer/scripts/post-create.sh index b1e3d12c..e74880bf 100755 --- a/.devcontainer/scripts/post-create.sh +++ b/.devcontainer/scripts/post-create.sh @@ -7,4 +7,5 @@ echo "Installing Nerd Fonts..." ./setup-fonts.sh # echo "Installing tools for Go development..." -# ./../../scripts/install-tools.sh +echo "set permission for running scripts" +./setup-devcontainers.sh \ No newline at end of file diff --git a/.devcontainer/scripts/setup-devcontainers.sh b/.devcontainer/scripts/setup-devcontainers.sh new file mode 100644 index 00000000..d923129a --- /dev/null +++ b/.devcontainer/scripts/setup-devcontainers.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +echo "Setting up devcontainer environment..." +chmod +x ./scripts/*.sh +echo "Permissions set." \ No newline at end of file diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..8399f3eb --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,166 @@ +# https://github.com/actions/labeler + +# In some configurations (like Release Drafter), regex is enclosed with slashes (e.g., /build\/.+/), which signifies the start and end of the regular expression. +# However, in GitHub Actions' labeler.yml, you do not need to wrap your regex patterns in slashes. The tool expects just the regex itself, without the delimiters. + +ansible: +- changed-files: + - any-glob-to-any-file: + - '.ansible-lint' + - 'ansible.cfg' + - 'ansible/*' + - 'molecule/*' + +configuration: +- changed-files: + - any-glob-to-any-file: + - '.github/*yml' + - '.gitignore' + - '.gitattributes' + - '.vscode/*' + - '.devcontainer/*' + - '.editorconfig' + - '.yamllint.yml' + - '.ansible-lint' + +docker: +- changed-files: + - any-glob-to-any-file: + - '**/Dockerfile' + - '**/docker-compose.yml' + - '**/docker-compose.yaml' + - '**/docker-compose.test.yml' + +github: +- any: + - changed-files: + - any-glob-to-any-file: + - '.github/*' + - '!.github/workflows/' + +source: +- all: + - changed-files: + - any-glob-to-any-file: 'src/**/*' + - all-globs-to-all-files: '!src/docs/*' + +policy: +- changed-files: + - any-glob-to-any-file: + - '.github/ISSUE_TEMPLATE/*' + - '.github/PULL_TEMPLATE/*' + - 'LICENSE' + - 'SECURITY.md' + +terraform: +- changed-files: + - any-glob-to-any-file: + - 'terraform/*' + - '**/*.tf' + - '**/*.lock.hcl' + +vscode: +- changed-files: + - any-glob-to-any-file: + - '.vscode/*' + +feature: +- head-branch: + - '^(feat)(\([a-z ]+\))?\/.' + - '^(feature)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +ci-cd: +- head-branch: + - '^(ci)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - '.github/workflows/*' + - '.github/*' + +devops: +- head-branch: + - '^(ci)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - 'deployments/*' + - '.github/workflows/*' + - '.github/*' + - 'terraform/*' + - '**/*.tf' + - '**/*.lock.hcl' + - '**/Dockerfile' + - '**/docker-compose.yml' + - '**/docker-compose.yaml' + - '**/docker-compose.test.yml' + +style: +- head-branch: + - '^(style)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +documentation: +- head-branch: + - '^(docs)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - '**/*.md' + - '**/*.rst' + - '**/*.txt' + - docs/** + - guides/* + +performance: +- head-branch: + - '^(perf)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +bug: +- head-branch: + - '^(fix)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +enhancement: +- head-branch: + - '^(refactor)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +build: +- head-branch: + - '^(build)(\([a-z ]+\))?\/.' + +dependencies: +- head-branch: + - '^(build)(\([a-z ]+\))?\/.' + +chore: +- head-branch: + - '^(chore)(\([a-z ]+\))?\/.' + +test: +- head-branch: + - '^(test)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - 'test/*' + - 'molecule/*' + - 'docker-compose.test.yml' + +minor: +- head-branch: + - '^(feat)(\([a-z ]+\))?\/.' + +patch: +- head-branch: + - '^(fix)(\([a-z ]+\))?\/.' + - '^(ci)(\([a-z ]+\))?\/.' diff --git a/.github/multi-labeler.yml b/.github/multi-labeler.yml index f4a4e210..d83f975d 100644 --- a/.github/multi-labeler.yml +++ b/.github/multi-labeler.yml @@ -3,85 +3,86 @@ version: v1 labels: - - label: "feature" - matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '(feat)(\([a-z ]+\))?\/.' +- label: "feature" + matcher: + title: '/^(feat)(\([a-z ]+\))?: .+/' + commits: '/^(feat)(\([a-z ]+\))?: .+/' + branch: '/^(feat)(\([a-z ]+\))?\/.+/' - - label: "bug" - matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '(fix)(\([a-z ]+\))?\/.' +- label: "bug" + matcher: + title: '/^(fix)(\([a-z ]+\))?: .+/' + commits: '/^(fix)(\([a-z ]+\))?: .+/' + branch: '/^(fix)(\([a-z ]+\))?\/.+/' - - label: "chore" - matcher: - title: '^(chore)(\([a-z ]+\))?: .' - commits: '^(chore)(\([a-z ]+\))?: .' - branch: '(chore)(\([a-z ]+\))?\/.' +- label: "chore" + matcher: + title: '/^(chore)(\([a-z ]+\))?: .+/' + commits: '/^(chore)(\([a-z ]+\))?: .+/' + branch: '/^(chore)(\([a-z ]+\))?\/.+/' - - label: "documentation" - matcher: - title: '^(docs)(\([a-z ]+\))?: .' - commits: '^(docs)(\([a-z ]+\))?: .' - branch: '(docs)(\([a-z ]+\))?\/.' +- label: "documentation" + matcher: + title: '/^(docs)(\([a-z ]+\))?: .+/' + commits: '/^(docs)(\([a-z ]+\))?: .+/' + branch: '/^(docs)(\([a-z ]+\))?\/.+/' - - label: "devops" - matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '(ci)(\([a-z ]+\))?\/.' +- label: "devops" + matcher: + title: '/^(ci)(\([a-z ]+\))?: .+/' + commits: '/^(ci)(\([a-z ]+\))?: .+/' + branch: '/^(ci)(\([a-z ]+\))?\/.+/' - - label: "ci/cd" - matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '(ci)(\([a-z ]+\))?\/.' +- label: "ci-cd" + matcher: + title: '/^(ci)(\([a-z ]+\))?: .+/' + commits: '/^(ci)(\([a-z ]+\))?: .+/' + branch: '/^(ci)(\([a-z ]+\))?\/.+/' - - label: "enhancement" - matcher: - title: '^(refactor)(\([a-z ]+\))?: .' - commits: '^(refactor)(\([a-z ]+\))?: .' - branch: '(refactor)(\([a-z ]+\))?\/.' +- label: "enhancement" + matcher: + title: '/^(refactor)(\([a-z ]+\))?: .+/' + commits: '/^(refactor)(\([a-z ]+\))?: .+/' + branch: '/^(refactor)(\([a-z ]+\))?\/.+/' - - label: "formatting" - matcher: - title: '^(style)(\([a-z ]+\))?: .' - commits: '^(style)(\([a-z ]+\))?: .' - branch: '(style)(\([a-z ]+\))?\/.' +- label: "style" + matcher: + title: '/^(style)(\([a-z ]+\))?: .+/' + commits: '/^(style)(\([a-z ]+\))?: .+/' + branch: '/^(style)(\([a-z ]+\))?\/.+/' - - label: "performance" - matcher: - title: '^(perf)(\([a-z ]+\))?: .' - commits: '^(perf)(\([a-z ]+\))?: .' - branch: '(perf)(\([a-z ]+\))?\/.' +- label: "performance" + matcher: + title: '/^(perf)(\([a-z ]+\))?: .+/' + commits: '/^(perf)(\([a-z ]+\))?: .+/' + branch: '/^(perf)(\([a-z ]+\))?\/.+/' - - label: "build" - matcher: - title: '^(build)(\([a-z ]+\))?: .' - commits: '^(build)(\([a-z ]+\))?: .' - branch: '(build)(\([a-z ]+\))?\/.' +- label: "build" + matcher: + title: '/^(build)(\([a-z ]+\))?: .+/' + commits: '/^(build)(\([a-z ]+\))?: .+/' + branch: '/^(build)(\([a-z ]+\))?\/.+/' - - label: "test" - matcher: - title: '^(test)(\([a-z ]+\))?: .' - commits: '^(test)(\([a-z ]+\))?: .' - branch: '(test)(\([a-z ]+\))?\/.' +- label: "test" + matcher: + title: '/^(test)(\([a-z ]+\))?: .+/' + commits: '/^(test)(\([a-z ]+\))?: .+/' + branch: '/^(test)(\([a-z ]+\))?\/.+/' - - label: "dependencies" - matcher: - title: '^build\(deps\): .' - commits: '^build\(deps\): .' +- label: "dependencies" + matcher: + title: '/^(build)(\([a-z ]+\))?: .+/' + commits: '/^(build)(\([a-z ]+\))?: .+/' + branch: '/^(build)(\([a-z ]+\))?\/.+/' - - label: "minor" - matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '(feat)(\([a-z ]+\))?\/.' +- label: "minor" + matcher: + title: '/^(feat)(\([a-z ]+\))?: .+/' + commits: '/^(feat)(\([a-z ]+\))?: .+/' + branch: '/^(feat)(\([a-z ]+\))?\/.+/' - - label: "patch" - matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '(fix)(\([a-z ]+\))?\/.' \ No newline at end of file +- label: "patch" + matcher: + title: '/^(fix)(\([a-z ]+\))?: .+/' + commits: '/^(fix)(\([a-z ]+\))?: .+/' + branch: '/^(fix)(\([a-z ]+\))?\/.+/' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index fe5c24d6..8b032643 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -15,101 +15,138 @@ template: | $CHANGES **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION categories: - - title: πŸš€ Features - labels: - - feature - - title: ♻️ Enhancement - labels: - - enhancement - - refactor - - title: πŸ› Bug Fixes - labels: - - fix - - bug - - title: πŸ‘· CI - labels: - - ci - - title: ⚠️ Breaking Changes - labels: - - breaking-changes - - title: ⛔️ Deprecated - labels: - - deprecated - - title: πŸ—‘ Removed - labels: - - removed - - title: πŸ” Security - labels: - - security - - title: πŸ“„ Documentation - labels: - - docs - - documentation - - title: 🧩 Dependency Updates - labels: - - deps - - dependencies - - title: 🧰 Maintenance - label: 'chore' - - title: 🧺 Miscellaneous #Everything except ABAP - label: misc - - title: 🚩 Other changes -## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934 - +- title: πŸš€ Features + labels: + - feature + - feat +- title: ♻️ Enhancement + labels: + - enhancement + - refactor +- title: πŸ› Bug Fixes + labels: + - fix + - bug +- title: πŸ‘· CI + labels: + - ci + - ci-cd + - devops +- title: ⚠️ Breaking Changes + labels: + - breaking-changes + - major +- title: ⛔️ Deprecated + labels: + - deprecated +- title: πŸ—‘ Removed + labels: + - removed +- title: πŸ” Security + labels: + - security +- title: 🎨 Style & Formatting + labels: + - style +- title: πŸ§ͺ Test + labels: + - test +- title: πŸ“„ Documentation + labels: + - docs + - documentation +- title: 🧩 Dependency Updates + labels: + - deps + - build + - dependencies +- title: 🧰 Maintenance + label: 'chore' +- title: 🧺 Miscellaneous #Everything except ABAP + label: misc +- title: 🚩 Other changes + ## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934 # https://www.trywilco.com/post/wilco-ci-cd-github-heroku # https://github.com/release-drafter/release-drafter#autolabeler # https://github.com/fuxingloh/multi-labeler - # Using regex for defining rules - https://regexr.com/ # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax +# Note: because of escaping logic inside of release drafter our regex should be escaped correctly and drafter wil un-escape it internally +# - Escaped regex: When writing a regular expression as a string in code, special characters like (, ), and : need to be escaped with a backslash (\) because these characters have special meanings in regex. +# - Unescaped regex: If you use a raw regex literal (i.e., surrounded by slashes /.../), the regex engine interprets it directly, and you don’t need to double-escape the special characters. autolabeler: - - label: 'chore' +- label: 'chore' + branch: + - '/^(chore)(\([a-z ]+\))?\/.+/' + title: + - '/^(chore)(\([a-z ]+\))?: .+/' +- label: 'enhancement' + branch: + - '/^(refactor)(\([a-z ]+\))?\/.+/' + title: + - '/^(refactor)(\([a-z ]+\))?: .+/' +- label: 'documentation' + branch: + - '/^(docs)(\([a-z ]+\))?\/.+/' + title: + - '/^(docs)(\([a-z ]+\))?: .+/' +- label: 'ci-cd' branch: - - '(chore)(\([a-z ]+\))?\/.' + - '/^(ci)(\([a-z ]+\))?\/.+/' title: - - '^(chore)(\([a-z ]+\))?: .' - - label: 'bug' + - '/^(ci)(\([a-z ]+\))?: .+/' +- label: 'devops' branch: - - '(fix)(\([a-z ]+\))?\/.' + - '/^(ci)(\([a-z ]+\))?\/.+/' title: - - '^(fix)(\([a-z ]+\))?: .' - - label: 'feature' + - '/^(ci)(\([a-z ]+\))?: .+/' +- label: 'test' branch: - - '(feat)(\([a-z ]+\))?\/.' + - '/^(test)(\([a-z ]+\))?\/.+/' title: - - '^(feat)(\([a-z ]+\))?: .' - - label: 'ci/cd' + - '/^(test)(\([a-z ]+\))?: .+/' +- label: 'bug' branch: - - '(ci)(\([a-z ]+\))?\/.' + - '/^(fix)(\([a-z ]+\))?\/.+/' title: - - '^(ci)(\([a-z ]+\))?: .' - - label: 'minor' + - '/^(fix)(\([a-z ]+\))?: .+/' +- label: 'style' branch: - - '(feat)(\([a-z ]+\))?\/.' + - '/^(style)(\([a-z ]+\))?\/.+/' title: - - '^(feat)(\([a-z ]+\))?: .' - - label: 'patch' + - '/^(style)(\([a-z ]+\))?: .+/' +- label: 'feature' branch: - - '(fix)(\([a-z ]+\))?\/.' - - '(ci)(\([a-z ]+\))?\/.' + - '/^(feat)(\([a-z ]+\))?\/.+/' title: - - '^(fix)(\([a-z ]+\))?: .' - - '^(ci)(\([a-z ]+\))?: .' + - '/^(feat)(\([a-z ]+\))?: .+/' +- label: 'minor' + branch: + - '/^(feat)(\([a-z ]+\))?\/.+/' + title: + - '/^(feat)(\([a-z ]+\))?: .+/' +- label: 'patch' + branch: + - '/^(fix)(\([a-z ]+\))?\/.+/' + - '/^(ci)(\([a-z ]+\))?\/.+/' + title: + - '/^(fix)(\([a-z ]+\))?: .+/' + - '/^(ci)(\([a-z ]+\))?: .+/' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: major: labels: - - breaking-changes + - breaking-changes minor: labels: - - minor + - minor patch: labels: - - patch + - patch default: patch exclude-labels: - - skip-changelog +- skip-changelog diff --git a/.github/release.yml b/.github/release.yml index 49f96b49..04570c8d 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -7,41 +7,57 @@ changelog: exclude: labels: - - ignore-for-release + - ignore-for-release categories: - - title: πŸš€ Features - labels: - - feature - - title: πŸ› Bug Fixes - labels: - - fix - - bug - - title: ♻️ Changes - labels: - - changed - - enhancement - - refactor - - title: ⛔️ Deprecated - labels: - - deprecated - - title: πŸ—‘ Removed - labels: - - removed - - title: πŸ” Security - labels: - - security - - title: πŸ“„ Documentation - labels: - - docs - - documentation - - title: 🧩 Dependency Updates - labels: - - deps - - dependencies - - title: 🧰 Maintenance - label: 'chore' - - title: 🧺 Miscellaneous #Everything except ABAP - label: misc - - title: Other Changes - labels: - - "*" + - title: πŸš€ Features + labels: + - feature + - feat + - title: ♻️ Enhancement + labels: + - enhancement + - refactor + - title: πŸ› Bug Fixes + labels: + - fix + - bug + - title: πŸ‘· CI + labels: + - ci + - ci-cd + - devops + - title: ⚠️ Breaking Changes + labels: + - breaking-changes + - major + - title: ⛔️ Deprecated + labels: + - deprecated + - title: πŸ—‘ Removed + labels: + - removed + - title: πŸ” Security + labels: + - security + - title: 🎨 Style & Formatting + labels: + - style + - title: πŸ§ͺ Test + labels: + - test + - title: πŸ“„ Documentation + labels: + - docs + - documentation + - title: 🧩 Dependency Updates + labels: + - deps + - build + - dependencies + - title: 🧰 Maintenance + label: 'chore' + - title: 🧺 Miscellaneous #Everything except ABAP + label: misc + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml deleted file mode 100644 index 1d5ae2aa..00000000 --- a/.github/workflows/conventional-commits.yml +++ /dev/null @@ -1,57 +0,0 @@ -# https://github.com/amannn/action-semantic-pull-request -# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests -# Linting workflow: https://github.com/rhysd/actionlint - -name: Conventional Commits - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled - - edited - - ready_for_review - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - - # https://github.com/amannn/action-semantic-pull-request -permissions: - pull-requests: read - -jobs: - conventional-commits: - runs-on: ubuntu-latest - steps: - - name: Check Pull Request Title Conventional Commits - uses: amannn/action-semantic-pull-request@v5 - if: always() - id: check-pull-request-title-conventional-commits - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Comments the error message from the above lint_pr_title action - - if: ${{ always() && steps.check-pull-request-title-conventional-commits.outputs.error_message != null}} - name: Comment on PR - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - message: | - We require all PRs to follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - More details πŸ‘‡πŸΌ - ``` - ${{ steps.check-pull-request-title-conventional-commits.outputs.error_message}} - ``` - # deletes the error comment if the title is correct - - if: ${{ steps.check-pull-request-title-conventional-commits.outputs.error_message == null }} - name: delete the comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - delete: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/first-interaction.yml b/.github/workflows/first-interaction.yml deleted file mode 100644 index e855b068..00000000 --- a/.github/workflows/first-interaction.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: First interaction -on: - pull_request_target: - types: - - opened - issues: - types: - - opened - -jobs: - first-interaction: - runs-on: ubuntu-latest - name: First interaction - - # https://github.com/actions/first-interaction/issues/10#issuecomment-1278292860 - permissions: - contents: read - issues: write - pull-requests: write - - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Welcome to go-food-delivery-microservices. Thank you ${{ github.event.pull_request.user.login }} for reporting your first issue. Please check out our [contributor guide](https://github.com/mehdihadeli/go-food-delivery-microservices/blob/main/CONTRIBUTION.md)." - pr-message: "Thank you ${{ github.event.pull_request.user.login }} for your first pull request to go-food-delivery-microservices repository. Please check out our [contributors guide](https://github.com/mehdihadeli/go-food-delivery-microservices/blob/main/CONTRIBUTION.md)." diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 8711c927..630a728b 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,40 +1,53 @@ -name: "Pull Request Labeler" +name: Auto Labeler on: pull_request: - types: [ opened, edited, synchronize, ready_for_review ] + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + # pull_request_target: jobs: - auto-labeling: + auto-labeler: + name: Auto Labeler runs-on: ubuntu-latest permissions: - # Setting up permissions in the workflow to limit the scope of what it can do. Optional! - contents: read + # write permission is required for autolabeler + # otherwise, read permission is required at least pull-requests: write - statuses: write - checks: write - + contents: read + ## just for multi-labeler + # statuses: write + # checks: write + steps: - - uses: fuxingloh/multi-labeler@v1 - name: conventional-commits-pull-request-labeler + - uses: release-drafter/release-drafter@v6 with: - github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' - config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' + config-name: release-drafter.yml + disable-releaser: true # releaser mode is disabled. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - uses: release-drafter/release-drafter@v5 - # name: release-drafter auto labeler - # with: - # config-name: release-drafter.yml - # disable-releaser: true # only run auto-labeler for PRs - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - uses: fuxingloh/multi-labeler@v1 + # name: conventional-commits-pull-request-labeler + # with: + # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' + # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' - # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs - # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow + # # https://github.com/actions/labeler + # - uses: actions/labeler@v5 + # with: + # repo-token: "${{ secrets.GITHUB_TOKEN }}" + # sync-labels: true + + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - name: check-conventional-commits-labels uses: docker://agilepathway/pull-request-label-checker:latest if: success() with: - any_of : feature,bug,enhancement,refactor,deprecated,security,documentation,build,ci/cd,chore,performance,formatting,dependencies + any_of: feature,bug,enhancement,refactor,deprecated,security,documentation,build,ci/cd,devops,chore,performance,formatting,dependencies,test,major,minor,patch repo_token: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 112ffa17..b5bce645 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,26 +5,23 @@ name: Release Drafter on: push: branches: - - main + - "main" jobs: - update_release_draft: + update-release-draft: name: Release drafter runs-on: ubuntu-latest permissions: # write permission is required to create a github release contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least - pull-requests: write - steps: - name: Update Release Draft - uses: release-drafter/release-drafter@v5 + uses: release-drafter/release-drafter@v6 id: semantic with: config-name: release-drafter.yml + disable-autolabeler: true ## Default versioning just increase the path version as default. but the can use minor, patch and breaking-changes labels to apply semver # version: 1.29.1 env: diff --git a/.vscode/settings.json b/.vscode/settings.json index e71c67b6..bfe7cbcb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -45,5 +45,6 @@ "go.formatTool": "gofumpt", "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "CodeGPT.apiKey": "CodeGPT Plus Beta" } diff --git a/scripts/install-tools.sh b/scripts/install-tools.sh index 4b60b113..9a7d54d7 100644 --- a/scripts/install-tools.sh +++ b/scripts/install-tools.sh @@ -32,8 +32,6 @@ go install github.com/mgechev/revive@latest # https://github.com/dominikh/go-tools go install honnef.co/go/tools/cmd/staticcheck@latest -go install google.golang.org/protobuf/proto@latest - # https://dev.to/techschoolguru/how-to-define-a-protobuf-message-and-generate-go-code-4g4e # https://stackoverflow.com/questions/13616033/install-protocol-buffers-on-windows go install github.com/golang/protobuf/protoc-gen-go@latest @@ -60,17 +58,14 @@ go install github.com/vektra/mockery/v2@latest go install github.com/onsi/ginkgo/v2/ginkgo@latest +go install github.com/bufbuild/buf/cmd/buf@latest + +# https://github.com/ariga/atlas#quick-installation +npx @ariga/atlas + OS="$(uname -s)" if [[ "$OS" == "Linux" ]]; then - # https://github.com/bufbuild/buf - echo "Installing Buff on Linux..." - # Linux installation commands - curl -sSL https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64 \ - -o /usr/local/bin/buf - chmod +x /usr/local/bin/buf - echo "Buff installed successfully." - # https://k6.io/docs/get-started/installation/ echo "Installing k6 on Linux..." sudo gpg -k @@ -80,22 +75,11 @@ if [[ "$OS" == "Linux" ]]; then sudo apt-get install k6 sudo apt install diffutils - # Install atlas on linux - curl -sSf https://atlasgo.sh | sh - # https://grpc.io/docs/protoc-installation/ - apt install -y protobuf-compiler + sudo apt install -y protobuf-compiler elif [[ "$OS" == "MINGW"* || "$OS" == "MSYS"* ]]; then # https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md - # https://github.com/bufbuild/buf - echo "Installing Buff on Windows..." - # Windows installation commands - curl -sSL https://github.com/bufbuild/buf/releases/latest/download/buf-Windows-x86_64.exe \ - -o buf.exe - Move-Item -Force buf.exe $Env:ProgramFiles\buf.exe - echo "Buff installed successfully." - # https://k6.io/docs/get-started/installation/ echo "Installing k6 on Windows..." winget install k6 diff --git a/scripts/lint.sh b/scripts/lint.sh index 3918570b..f00383d7 100644 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -25,3 +25,6 @@ staticcheck ./... # https://golangci-lint.run/usage/configuration/ # https://golangci-lint.run/usage/quick-start/ golangci-lint run ./... + +# https://github.com/kisielk/errcheck +errcheck ./...