forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/fix: Add missing specification to GitHub Acti
- Loading branch information
1 parent
8d6faf5
commit 23a6399
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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") |