forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (25 loc) · 1008 Bytes
/
main.yml
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
import yaml
def update_workflow_file(file_path):
# Open the workflow file
with open(file_path, 'r') as file:
# Parse the YAML content
workflow_dict = yaml.safe_load(file)
# Locate the google-github-actions/auth@v1 step
steps = workflow_dict['jobs']['build']['steps']
for step in steps:
if step['uses'] == 'google-github-actions/auth@v1':
# Add the missing specification as an input
step['with'] = {
'workload_identity_provider': 'your_workload_identity_provider',
# or
'credentials_json': 'your_credentials_json'
}
# Inject the input value into the environment
step['env'] = {
'YOUR_ENV_VARIABLE': '${{ secrets.YOUR_SECRET }}'
}
# Save the modified workflow file
with open(file_path, 'w') as file:
yaml.dump(workflow_dict, file)
# Update the workflow file
update_workflow_file(".github/workflows/main.yml")