Skip to content

Commit bff016a

Browse files
Merge pull request #196 from regulaforensics/feature/automatization-web-clients
[SP-18628] Automatization web clients
2 parents 5a76845 + 1c43bc2 commit bff016a

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Back Merge handler
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- stable
8+
9+
jobs:
10+
pr_master_to_stable:
11+
runs-on: ubuntu-latest
12+
if: github.ref_name == 'master'
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Check if PR exists
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
run: |
22+
prs=$(gh pr list \
23+
--repo "$GITHUB_REPOSITORY" \
24+
--json baseRefName,headRefName \
25+
--jq '
26+
map(select(.baseRefName == "stable" and .headRefName == "master"))
27+
| length
28+
')
29+
if ((prs > 0)); then
30+
echo "Pull Request already exists"
31+
echo "SKIP=true" >> $GITHUB_ENV
32+
fi
33+
34+
- name: Check if stable is ahead
35+
run: |
36+
commits=$(git rev-list origin/stable..origin/master --count)
37+
if ((commits == 0)); then
38+
echo "No diffs was found between branches"
39+
echo "SKIP=true" >> $GITHUB_ENV
40+
fi
41+
42+
- name: Create Pull Request
43+
if: env.SKIP != 'true'
44+
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'
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
pr_stable_to_develop:
49+
runs-on: ubuntu-latest
50+
if: github.ref_name == 'stable'
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 0
55+
56+
- name: Check if PR exists
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
run: |
60+
prs=$(gh pr list \
61+
--repo "$GITHUB_REPOSITORY" \
62+
--json baseRefName,headRefName \
63+
--jq '
64+
map(select(.baseRefName == "develop" and .headRefName == "stable"))
65+
| length
66+
')
67+
if ((prs > 0)); then
68+
echo "Pull Request already exists"
69+
echo "SKIP=true" >> $GITHUB_ENV
70+
fi
71+
72+
- name: Check if stable is ahead
73+
run: |
74+
commits=$(git rev-list origin/develop..origin/stable --count)
75+
if ((commits == 0)); then
76+
echo "No diffs was found between branches"
77+
echo "SKIP=true" >> $GITHUB_ENV
78+
fi
79+
80+
- name: Create Pull Request
81+
if: env.SKIP != 'true'
82+
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'
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Make PRs for OpenAPI and client repositories
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
source_branch:
7+
description: "Source branch"
8+
default: "develop"
9+
type: choice
10+
required: true
11+
options:
12+
- develop
13+
- master
14+
- stable
15+
target_branch:
16+
description: "Target branch"
17+
default: "master"
18+
type: choice
19+
required: true
20+
options:
21+
- develop
22+
- master
23+
- stable
24+
25+
jobs:
26+
python-webclient-pr:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Create PR for Python WebClient Repo
30+
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
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
33+
java-webclient-pr:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Create PR for Java WebClient Repo
37+
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
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
40+
js-webclient-pr:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Create PR for JS WebClient Repo
44+
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
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
47+
csharp-webclient-pr:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Create PR for CSharp WebClient Repo
51+
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
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
54+
openapi-pr:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Create PR for OpenAPI Repo
58+
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
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

0 commit comments

Comments
 (0)