From 427617ddd3a0cbd8cfae36080a024311226e6e94 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 12:07:55 +0300 Subject: [PATCH 01/10] init new workflow --- .../workflows/make-prs-for-client-repos.yml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .github/workflows/make-prs-for-client-repos.yml diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml new file mode 100644 index 00000000..9a2bccf6 --- /dev/null +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -0,0 +1,136 @@ +name: Make PRs for client repos + +on: + workflow_dispatch: + inputs: + source_branch: + description: "Source branch" + default: "develop" + type: choice + required: true + options: + - develop + - master + - stable + target_branch: + description: "Target branch" + default: "master" + type: choice + required: true + options: + - develop + - master + - stable + +jobs: + create-pr-for-python-client: + runs-on: ubuntu-latest + steps: + - name: Checkout Python Client Repo + uses: actions/checkout@4 + with: + repository: 'regulaforensics/DocumentReader-web-python-client' + token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + path: 'python-client' + - name: Create PR from source to target branch + working-directory: python-client + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title "[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' +# +# update-java-client: +# runs-on: ubuntu-latest +# steps: +# - name: Specify Java Version +# uses: actions/setup-java@v1 +# with: +# java-version: 11 +# java-package: jdk +# - name: Checkout Specification Repo +# uses: actions/checkout@v2 +# with: +# path: 'DocumentReader-web-openapi' +# - name: Checkout Java Client Repo +# uses: actions/checkout@v2 +# with: +# repository: 'regulaforensics/DocumentReader-web-java-client' +# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# path: 'java-client' +# - name: Update Model According To Specification +# working-directory: java-client +# run: | +# ./update-models.sh +# - name: Push Changes Back To Client Repo +# working-directory: java-client +# run: | +# git checkout -b ${GITHUB_SHA::8} +# git config --local user.email "action@github.com" +# git config --local user.name "GitHub Action" +# git add --all +# git commit -m "${{ github.event.inputs.title }}" -a +# git push --set-upstream origin ${GITHUB_SHA::8} +# gh pr create --fill --draft +# env: +# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# +# update-python-client: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Specification Repo +# uses: actions/checkout@v2 +# with: +# path: 'DocumentReader-web-openapi' +# - name: Checkout Python Client Repo +# uses: actions/checkout@v2 +# with: +# repository: 'regulaforensics/DocumentReader-web-python-client' +# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# path: 'python-client' +# - name: Update Model According To Specification +# working-directory: python-client +# run: | +# ./update-models.sh +# - name: Push Changes Back To Client Repo +# working-directory: python-client +# run: | +# git checkout -b ${GITHUB_SHA::8} +# git config --local user.email "action@github.com" +# git config --local user.name "GitHub Action" +# git add --all +# git commit -m "${{ github.event.inputs.title }}" -a +# git push --set-upstream origin ${GITHUB_SHA::8} +# gh pr create --fill --draft +# env: +# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# +# update-csharp-client: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Specification Repo +# uses: actions/checkout@v2 +# with: +# path: 'DocumentReader-web-openapi' +# - name: Checkout C# Client Repo +# uses: actions/checkout@v2 +# with: +# repository: 'regulaforensics/DocumentReader-web-csharp-client' +# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# path: 'csharp-client' +# - name: Update Model According To Specification +# working-directory: csharp-client +# run: | +# ./update-models.sh +# - name: Push Changes Back To Client Repo +# working-directory: csharp-client +# run: | +# git checkout -b ${GITHUB_SHA::8} +# git config --local user.email "action@github.com" +# git config --local user.name "GitHub Action" +# git checkout src/Regula.DocumentReader.WebClient/Api/DefaultApi.cs src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs +# git add --all +# git commit -m "${{ github.event.inputs.title }}" -a +# git push --set-upstream origin ${GITHUB_SHA::8} +# gh pr create --fill --draft +# env: +# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} From b94ef8d2edbbb9f4a5aa2f97a2dca5d1c7f1cb0c Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 13:12:52 +0300 Subject: [PATCH 02/10] test workflow --- .../workflows/make-prs-for-client-repos.yml | 66 ++++++++++--------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 9a2bccf6..6811702f 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -1,43 +1,49 @@ name: Make PRs for client repos on: - workflow_dispatch: - inputs: - source_branch: - description: "Source branch" - default: "develop" - type: choice - required: true - options: - - develop - - master - - stable - target_branch: - description: "Target branch" - default: "master" - type: choice - required: true - options: - - develop - - master - - stable + pull_request: + branches: + - feature/automatization-web-clients + +# workflow_dispatch: +# inputs: +# source_branch: +# description: "Source branch" +# default: "develop" +# type: choice +# required: true +# options: +# - develop +# - master +# - stable +# target_branch: +# description: "Target branch" +# default: "master" +# type: choice +# required: true +# options: +# - develop +# - master +# - stable jobs: create-pr-for-python-client: runs-on: ubuntu-latest steps: - - name: Checkout Python Client Repo - uses: actions/checkout@4 - with: - repository: 'regulaforensics/DocumentReader-web-python-client' - token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - path: 'python-client' +# - name: Checkout Python Client Repo +# uses: actions/checkout@4 +# with: +# repository: 'regulaforensics/DocumentReader-web-python-client' +# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} +# path: 'python-client' - name: Create PR from source to target branch - working-directory: python-client +# working-directory: python-client run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title "[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' + gh pr create --base stable --head develop --title "[GitHub Actions] Merge develop -> stable" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client +# gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title "[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client + env: + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + # # update-java-client: # runs-on: ubuntu-latest From 39622167dfab4f20cfb5010f1e1dd276cc42d997 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 13:13:44 +0300 Subject: [PATCH 03/10] test workflow --- .github/workflows/make-prs-for-client-repos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 6811702f..3c0021a3 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -1,7 +1,7 @@ name: Make PRs for client repos on: - pull_request: + push: branches: - feature/automatization-web-clients From 554175fee5e90145e4afb665341b32b1fa95898e Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 13:27:05 +0300 Subject: [PATCH 04/10] Update workflow --- .../workflows/make-prs-for-client-repos.yml | 156 +++--------------- 1 file changed, 25 insertions(+), 131 deletions(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 3c0021a3..ebd6c5ad 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -1,142 +1,36 @@ -name: Make PRs for client repos +name: Make PRs for client repositories on: - push: - branches: - - feature/automatization-web-clients - -# workflow_dispatch: -# inputs: -# source_branch: -# description: "Source branch" -# default: "develop" -# type: choice -# required: true -# options: -# - develop -# - master -# - stable -# target_branch: -# description: "Target branch" -# default: "master" -# type: choice -# required: true -# options: -# - develop -# - master -# - stable + workflow_dispatch: + inputs: + source_branch: + description: "Source branch" + default: "develop" + type: choice + required: true + options: + - develop + - master + - stable + target_branch: + description: "Target branch" + default: "master" + type: choice + required: true + options: + - develop + - master + - stable jobs: create-pr-for-python-client: runs-on: ubuntu-latest steps: -# - name: Checkout Python Client Repo -# uses: actions/checkout@4 -# with: -# repository: 'regulaforensics/DocumentReader-web-python-client' -# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# path: 'python-client' - name: Create PR from source to target branch -# working-directory: python-client run: | - gh pr create --base stable --head develop --title "[GitHub Actions] Merge develop -> stable" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client -# gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title "[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}" --label OpenAPI --body 'Autogenerated PR triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - -# -# update-java-client: -# runs-on: ubuntu-latest -# steps: -# - name: Specify Java Version -# uses: actions/setup-java@v1 -# with: -# java-version: 11 -# java-package: jdk -# - name: Checkout Specification Repo -# uses: actions/checkout@v2 -# with: -# path: 'DocumentReader-web-openapi' -# - name: Checkout Java Client Repo -# uses: actions/checkout@v2 -# with: -# repository: 'regulaforensics/DocumentReader-web-java-client' -# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# path: 'java-client' -# - name: Update Model According To Specification -# working-directory: java-client -# run: | -# ./update-models.sh -# - name: Push Changes Back To Client Repo -# working-directory: java-client -# run: | -# git checkout -b ${GITHUB_SHA::8} -# git config --local user.email "action@github.com" -# git config --local user.name "GitHub Action" -# git add --all -# git commit -m "${{ github.event.inputs.title }}" -a -# git push --set-upstream origin ${GITHUB_SHA::8} -# gh pr create --fill --draft -# env: -# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# -# update-python-client: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout Specification Repo -# uses: actions/checkout@v2 -# with: -# path: 'DocumentReader-web-openapi' -# - name: Checkout Python Client Repo -# uses: actions/checkout@v2 -# with: -# repository: 'regulaforensics/DocumentReader-web-python-client' -# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# path: 'python-client' -# - name: Update Model According To Specification -# working-directory: python-client -# run: | -# ./update-models.sh -# - name: Push Changes Back To Client Repo -# working-directory: python-client -# run: | -# git checkout -b ${GITHUB_SHA::8} -# git config --local user.email "action@github.com" -# git config --local user.name "GitHub Action" -# git add --all -# git commit -m "${{ github.event.inputs.title }}" -a -# git push --set-upstream origin ${GITHUB_SHA::8} -# gh pr create --fill --draft -# env: -# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# -# update-csharp-client: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout Specification Repo -# uses: actions/checkout@v2 -# with: -# path: 'DocumentReader-web-openapi' -# - name: Checkout C# Client Repo -# uses: actions/checkout@v2 -# with: -# repository: 'regulaforensics/DocumentReader-web-csharp-client' -# token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} -# path: 'csharp-client' -# - name: Update Model According To Specification -# working-directory: csharp-client -# run: | -# ./update-models.sh -# - name: Push Changes Back To Client Repo -# working-directory: csharp-client -# run: | -# git checkout -b ${GITHUB_SHA::8} -# git config --local user.email "action@github.com" -# git config --local user.name "GitHub Action" -# git checkout src/Regula.DocumentReader.WebClient/Api/DefaultApi.cs src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs -# git add --all -# git commit -m "${{ github.event.inputs.title }}" -a -# git push --set-upstream origin ${GITHUB_SHA::8} -# gh pr create --fill --draft -# env: -# GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} From a8bd821be2294ca4d9582816a6488c6ee82f95b4 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 13:30:32 +0300 Subject: [PATCH 05/10] Update workflow --- .github/workflows/make-prs-for-client-repos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index ebd6c5ad..6702b4af 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -32,5 +32,6 @@ jobs: gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client + gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} From 0bb350b3904237a54cd372e830e93727fb216650 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 13:31:05 +0300 Subject: [PATCH 06/10] Update workflow --- .github/workflows/make-prs-for-client-repos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 6702b4af..0fa5b79f 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -1,4 +1,4 @@ -name: Make PRs for client repositories +name: Make PRs for OpenAPI and client repositories on: workflow_dispatch: From 3b462b61669968c5a5f0b71b1cfcbd5d1d1fb710 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 16:53:55 +0300 Subject: [PATCH 07/10] Update workflow --- .../workflows/make-prs-for-client-repos.yml | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 0fa5b79f..60fb886d 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -23,15 +23,26 @@ on: - stable jobs: - create-pr-for-python-client: + create-prs-for-repositories: runs-on: ubuntu-latest steps: - - name: Create PR from source to target branch - run: | - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client - gh pr create --base ${{ github.event.inputs.target }} --head ${{ github.event.inputs.source }} --title '[GitHub Actions] Merge ${{ github.event.inputs.source }} -> ${{ github.event.inputs.target }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi + - name: Create PR for Python WebClient Repo + run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client + env: + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + - name: Create PR for Java WebClient Repo + run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client + env: + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + - name: Create PR for JS WebClient Repo + run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client + env: + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + - name: Create PR for CSharp WebClient Repo + run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client + env: + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + - name: Create PR for OpenAPI Repo + run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} From a923f232e64d7febbdcdf1e8f5b26dfd9f745546 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 16:55:01 +0300 Subject: [PATCH 08/10] Update workflow --- .github/workflows/make-prs-for-client-repos.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 60fb886d..839496e6 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -27,22 +27,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for Python WebClient Repo + continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - name: Create PR for Java WebClient Repo + continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - name: Create PR for JS WebClient Repo + continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - name: Create PR for CSharp WebClient Repo + continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} - name: Create PR for OpenAPI Repo + continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} From f797db0519c7d3a9e92b2d54e1b1e237243297c2 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Thu, 10 Oct 2024 17:36:18 +0300 Subject: [PATCH 09/10] update wf --- .github/workflows/make-prs-for-client-repos.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 839496e6..684a19b1 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -23,7 +23,7 @@ on: - stable jobs: - create-prs-for-repositories: + python-webclient-pr: runs-on: ubuntu-latest steps: - name: Create PR for Python WebClient Repo @@ -31,21 +31,33 @@ jobs: run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + java-webclient-pr: + runs-on: ubuntu-latest + steps: - name: Create PR for Java WebClient Repo continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + js-webclient-pr: + runs-on: ubuntu-latest + steps: - name: Create PR for JS WebClient Repo continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + csharp-webclient-pr: + runs-on: ubuntu-latest + steps: - name: Create PR for CSharp WebClient Repo continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + openapi-pr: + runs-on: ubuntu-latest + steps: - name: Create PR for OpenAPI Repo continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi From 1c43bc23900d47b4c17086b6225537c1a7f31d62 Mon Sep 17 00:00:00 2001 From: rchxx <=> Date: Fri, 11 Oct 2024 13:20:29 +0300 Subject: [PATCH 10/10] add back-merge workflow --- .github/workflows/back-merge-handler.yml | 84 +++++++++++++++++++ .../workflows/make-prs-for-client-repos.yml | 5 -- 2 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/back-merge-handler.yml diff --git a/.github/workflows/back-merge-handler.yml b/.github/workflows/back-merge-handler.yml new file mode 100644 index 00000000..0346f030 --- /dev/null +++ b/.github/workflows/back-merge-handler.yml @@ -0,0 +1,84 @@ +name: Back Merge handler + +on: + push: + branches: + - master + - stable + +jobs: + pr_master_to_stable: + runs-on: ubuntu-latest + if: github.ref_name == 'master' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if PR exists + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --json baseRefName,headRefName \ + --jq ' + map(select(.baseRefName == "stable" and .headRefName == "master")) + | length + ') + if ((prs > 0)); then + echo "Pull Request already exists" + echo "SKIP=true" >> $GITHUB_ENV + fi + + - name: Check if stable is ahead + run: | + commits=$(git rev-list origin/stable..origin/master --count) + if ((commits == 0)); then + echo "No diffs was found between branches" + echo "SKIP=true" >> $GITHUB_ENV + fi + + - name: Create Pull Request + if: env.SKIP != 'true' + run: gh pr create -B stable -H master --title '[GitHub Actions] Merge master -> stable' --label back-merge --body 'Autogenerated Pull Request for `back-merge` triggered by Github Actions' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + pr_stable_to_develop: + runs-on: ubuntu-latest + if: github.ref_name == 'stable' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if PR exists + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --json baseRefName,headRefName \ + --jq ' + map(select(.baseRefName == "develop" and .headRefName == "stable")) + | length + ') + if ((prs > 0)); then + echo "Pull Request already exists" + echo "SKIP=true" >> $GITHUB_ENV + fi + + - name: Check if stable is ahead + run: | + commits=$(git rev-list origin/develop..origin/stable --count) + if ((commits == 0)); then + echo "No diffs was found between branches" + echo "SKIP=true" >> $GITHUB_ENV + fi + + - name: Create Pull Request + if: env.SKIP != 'true' + run: gh pr create -B develop -H stable --title '[GitHub Actions] Merge stable -> develop' --label back-merge --body 'Autogenerated Pull Request for `back-merge` triggered by Github Actions' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/make-prs-for-client-repos.yml b/.github/workflows/make-prs-for-client-repos.yml index 684a19b1..cc71bd5a 100644 --- a/.github/workflows/make-prs-for-client-repos.yml +++ b/.github/workflows/make-prs-for-client-repos.yml @@ -27,7 +27,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for Python WebClient Repo - continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} @@ -35,7 +34,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for Java WebClient Repo - continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} @@ -43,7 +41,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for JS WebClient Repo - continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} @@ -51,7 +48,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for CSharp WebClient Repo - continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} @@ -59,7 +55,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Create PR for OpenAPI Repo - continue-on-error: true run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-openapi env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}