Skip to content

Commit e1b4efd

Browse files
ci(codegen): add input for batch index in codegen workflow (googleapis#29012)
* ci(codegen): add input for batch index in codegen workflow This allows to be manually called by specifying the batch index * Update batch_index input description in codegen.yaml Clarified the description for the batch_index input.
1 parent fe823db commit e1b4efd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/codegen.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
# See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
55
- cron: '18 0-2 * * *'
66
workflow_dispatch:
7+
inputs:
8+
batch_index:
9+
type: number
10+
description: Index of the batch ([0-2]). You must call this workflow one time per index in order to confirm the generation in all the jobs.
711

812
name: codegen
913
jobs:
@@ -57,8 +61,13 @@ jobs:
5761
secrets: inherit
5862
# The size of the batch is implicitly decided by the hour of the day.
5963
# For example, a job starting at "1:30" uses the chunk at the index 1 in the array.
60-
# If you manually invoke the workflow other hours than 0:00 - 2:59 and the array's length is 3,
61-
# this job is skipped because there's no element at the index in the array.
62-
if: ${{!!fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour]}}
64+
if: github.event_name != 'workflow_dispatch' && ${{!!fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour]}}
6365
with:
6466
services: ${{toJson(fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour])}}
67+
generate_dispatch:
68+
uses: googleapis/google-api-java-client-services/.github/workflows/generate.yaml@main
69+
needs: batch
70+
secrets: inherit
71+
if: github.event_name == 'workflow_dispatch'
72+
with:
73+
services: ${{toJson(fromJson(needs.batch.outputs.services).batches[inputs.batch_index])}}

0 commit comments

Comments
 (0)