From d91be46e470d6b8d7ce956990fc8cd6d1d79a67d Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Wed, 31 Jan 2024 13:44:49 +0100 Subject: [PATCH] add kodiak config --- .github/workflows/create-pr.yml | 46 +++++++++++++++++++--- .github/workflows/docs.yml | 70 ++++++++++++++++++++++++++------- .kodiak.toml | 4 ++ 3 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 .kodiak.toml diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml index 9ad154cd917..de43faa32db 100644 --- a/.github/workflows/create-pr.yml +++ b/.github/workflows/create-pr.yml @@ -2,26 +2,60 @@ on: push: branches: - 'gen-sdk-updates' + - 'after-release' name: Create Changes PR +# Declare default permissions as read only. +permissions: read-all + jobs: create_pr: name: Create/Update PR runs-on: ubuntu-latest steps: + # Get GitHub token via the CT SDKs App + - name: Generate GitHub token (via CT SDKs App) + id: generate_github_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CT_SDKS_APP_ID }} + private-key: ${{ secrets.CT_SDKS_APP_PEM }} + + - name: Get App user + id: get_app_user + env: + GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }} + run: | + export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id` + echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT" + - name: Checkout - uses: actions/checkout@v2 - - uses: jenschude/auto-create-pr-action@v0.3.1 + uses: actions/checkout@v4 + with: + token: ${{ steps.generate_github_token.outputs.token }} + + - uses: jenschude/auto-create-pr-action@a5369414c74963e6ec065dab49066d3711b8c1db + if: github.ref_name == "gen-sdk-updates" with: request_title: "Update generated SDKs" - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ steps.generate_github_token.outputs.token }} + label: automerge request_body: | - [ ] Changeset added - + ### Features - + ### Fixes - + ### Breaking changes + + - uses: jenschude/auto-create-pr-action@a5369414c74963e6ec065dab49066d3711b8c1db + if: github.ref_name == "after-release" + with: + request_title: "Update changelog" + github_token: ${{ steps.generate_github_token.outputs.token }} + label: automerge + request_body: | + Changelog updates diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3d9ff692b65..5607d7e36d8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,21 +13,45 @@ jobs: if: startsWith( github.ref, 'refs/tags/') steps: + # Get GitHub token via the CT SDKs App + - name: Generate GitHub token (via CT SDKs App) + id: generate_github_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CT_SDKS_APP_ID }} + private-key: ${{ secrets.CT_SDKS_APP_PEM }} + + - name: Get App user + id: get_app_user + env: + GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }} + run: | + export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id` + echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT" + - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - ref: master + ref: main + token: ${{ steps.generate_github_token.outputs.token }} + + - name: "Switch SDK to after release branch" + run: | + git fetch --depth=1 origin after-release || true + git checkout -B after-release origin/after-release || true + git checkout -B after-release + git log -1 - name: "remove API reference commit SHA" run: rm -rf reference.txt continue-on-error: true - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@e8f94e4dd298db5a6a2aa2d42fe0bcef6f2c9660 with: - commit_message: "TASK: Updating API ref SHA" - commit_user_name: automation-commercetools - commit_user_email: automation@commercetools.com - commit_author: Auto Mation + commit_message: "TASK: Updating version in README" + commit_author: ct-sdks[bot] <${{ steps.get_app_user.outputs.email }}> + commit_user_name: ct-sdks[bot] + commit_user_email: ${{ steps.get_app_user.outputs.email }} unittests: name: Build Docs @@ -35,16 +59,34 @@ jobs: runs-on: ubuntu-latest steps: + # Get GitHub token via the CT SDKs App + - name: Generate GitHub token (via CT SDKs App) + id: generate_github_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CT_SDKS_APP_ID }} + private-key: ${{ secrets.CT_SDKS_APP_PEM }} + + - name: Get App user + id: get_app_user + env: + GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }} + run: | + export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id` + echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT" + - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: sdk + token: ${{ steps.generate_github_token.outputs.token }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: doc ref: gh-pages + token: ${{ steps.generate_github_token.outputs.token }} - name: Install Doxygen run: sudo apt-get install doxygen -y @@ -57,12 +99,12 @@ jobs: env: PROJECT_NUMBER: ${{ github.ref_name }} - - run: rsync -r --delete ./sdk/docs ./doc + - run: rsync -r sdk/build/docs/javadoc/ doc/javadoc - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@e8f94e4dd298db5a6a2aa2d42fe0bcef6f2c9660 with: repository: doc commit_message: "Update docs" - commit_user_name: automation-commercetools - commit_user_email: automation@commercetools.com - commit_author: Auto Mation + commit_author: ct-sdks[bot] <${{ steps.get_app_user.outputs.email }}> + commit_user_name: ct-sdks[bot] + commit_user_email: ${{ steps.get_app_user.outputs.email }} diff --git a/.kodiak.toml b/.kodiak.toml new file mode 100644 index 00000000000..e8005e92989 --- /dev/null +++ b/.kodiak.toml @@ -0,0 +1,4 @@ +version = 1 + +[merge] +show_missing_automerge_label_message = false