forked from googleapis/google-api-php-client-services
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (138 loc) · 5.74 KB
/
Copy pathcodegen.yml
File metadata and controls
141 lines (138 loc) · 5.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
permissions:
contents: read
on:
schedule:
# daily at 12:30 am
- cron: '30 0 * * *'
workflow_dispatch:
name: codegen
jobs:
discovery:
uses: googleapis/discovery-artifact-manager/.github/workflows/list-services.yml@b66c7266666ca739b5ab3ca4e768effe83eacfb5 # master
batch:
runs-on: ubuntu-24.04
needs: discovery
outputs:
services: ${{ steps.chunk.outputs.result }}
steps:
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
id: chunk
env:
SERVICES_LIST: ${{ needs.discovery.outputs.services }}
with:
script: |
console.log('splitting service names list into batches')
const services = JSON.parse(process.env.SERVICES_LIST)
const result = {
"one": [],
"two": [],
};
for (let i = 0; i < services.length; i++) {
if (!["discovery", "websecurityscanner"].includes(services[i])) {
j = i < (services.length/2) ? "one" : "two";
result[j].push(services[i])
}
}
return result
generate_batch1:
runs-on: ubuntu-24.04
needs: batch
strategy:
fail-fast: false
max-parallel: 4
matrix:
service: ${{fromJson(needs.batch.outputs.services).one}}
steps:
- run: echo generating ${MATRIX_SERVICE}
env:
MATRIX_SERVICE: ${{ matrix.service }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 1
path: google-api-php-client-services
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: googleapis/discovery-artifact-manager
fetch-depth: 1
path: discovery-artifact-manager
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.14"
- id: find-preferred-versions
run: |
versions=$( jq -r --arg service "$MATRIX_SERVICE" '[.items[] | select(.name == $service) | select(.name == "admin" or .preferred).version] | join(",")' discovery-artifact-manager/discoveries/index.json )
echo "::set-output name=versions::$versions"
env:
MATRIX_SERVICE: ${{ matrix.service }}
- run: ./google-api-php-client-services/.github/workflows/generate.sh ${MATRIX_SERVICE} ${STEPS_FIND_PREFERRED_VERSIONS_OUTPUTS_VERSIONS}
env:
MATRIX_SERVICE: ${{ matrix.service }}
STEPS_FIND_PREFERRED_VERSIONS_OUTPUTS_VERSIONS: ${{ steps.find-preferred-versions.outputs.versions }}
- uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: ${{ github.repository_owner }}
upstream_repo: google-api-php-client-services
description: 'Generated in GitHub action: https://github.com/${{ github.repository_owner }}/${{ github.repository }}/actions/workflows/codegen.yaml'
title: 'Regenerate ${{ matrix.service }} client'
message: 'Regenerate ${{ matrix.service }} client'
branch: regenerate-${{ matrix.service }}
git_dir: 'google-api-php-client-services/src'
primary: main
force: true
fork: true
generate_batch2:
runs-on: ubuntu-24.04
needs: batch
strategy:
fail-fast: false
max-parallel: 4
matrix:
service: ${{fromJson(needs.batch.outputs.services).two}}
steps:
- run: echo generating ${MATRIX_SERVICE}
env:
MATRIX_SERVICE: ${{ matrix.service }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 1
path: google-api-php-client-services
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: googleapis/discovery-artifact-manager
fetch-depth: 1
path: discovery-artifact-manager
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.14"
- id: find-preferred-versions
run: |
versions=$( jq -r --arg service "$MATRIX_SERVICE" '[.items[] | select(.name == $service) | select(.name == "admin" or .preferred).version] | join(",")' discovery-artifact-manager/discoveries/index.json )
echo "::set-output name=versions::$versions"
env:
MATRIX_SERVICE: ${{ matrix.service }}
- run: ./google-api-php-client-services/.github/workflows/generate.sh ${MATRIX_SERVICE} ${STEPS_FIND_PREFERRED_VERSIONS_OUTPUTS_VERSIONS}
env:
MATRIX_SERVICE: ${{ matrix.service }}
STEPS_FIND_PREFERRED_VERSIONS_OUTPUTS_VERSIONS: ${{ steps.find-preferred-versions.outputs.versions }}
- uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: ${{ github.repository_owner }}
upstream_repo: google-api-php-client-services
description: 'Generated in GitHub action: https://github.com/${{ github.repository_owner }}/${{ github.repository }}/actions/workflows/codegen.yaml'
title: 'Regenerate ${{ matrix.service }} client'
message: 'Regenerate ${{ matrix.service }} client'
branch: regenerate-${{ matrix.service }}
git_dir: 'google-api-php-client-services/src'
primary: main
force: true
fork: true