From 76be193983002ff5708185a33e7e852f884adb25 Mon Sep 17 00:00:00 2001 From: josedev-union Date: Thu, 18 Jan 2024 09:45:14 +0200 Subject: [PATCH] feat(ci): add release pipeline and pr-linter following conventional Commits Spec --- .github/workflows/{build.yml => image.yml} | 0 .github/workflows/lint-pr.yml | 46 ++++++++++++++++++++++ .github/workflows/release.yml | 22 +++++++++++ 3 files changed, 68 insertions(+) rename .github/workflows/{build.yml => image.yml} (100%) create mode 100644 .github/workflows/lint-pr.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/image.yml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/image.yml diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 0000000000000..73dfe9f3a6a3d --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,46 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - reopened + - synchronize + +permissions: + pull-requests: write + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000000..6e1f1f5ea0512 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: release + +on: + push: + branches: + - ortege + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: Run "release-please" + uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4 + with: + command: manifest