gpt-4.1-2025-04-14· OpenAI
LMArena Human Preference 140K
Make a cloud workflows yaml that list all the files in cloud storage containing 2025
- User
Make a cloud workflows yaml that list all the files in cloud storage containing 2025
- Assistant
Certainly! Below is a sample Cloud Workflows YAML that lists all files in a Google Cloud Storage bucket containing "2025" in their names. This workflow uses the Cloud Storage JSON API to list objects and filters them.
Assumptions:
- You have a bucket named
YOUR_BUCKET_NAME(replace with your actual bucket name). - The workflow uses the
access_tokenfor authentication.
# cloud-workflow-list-2025-files.yaml main: params: [bucket] steps: - init: assign: - pageToken: "" - filesWith2025: [] - listFiles: call: http.get args: url: ${"https://storage.googleapis.com/storage/v1/b/" + bucket + "/o?pageToken=" + pageToken} auth: type: OAuth2 result: response - filterFiles: assign: - items: ${response.body.items} - filesWith2025: ${filesWith2025 + [item.name for item in items if "2025" in item.name]} - checkNextPage: switch: - condition: ${"nextPageToken" in response.body} next: setNextPage - condition: ${true} next: returnFiles - setNextPage: assign: - pageToken: ${response.body.nextPageToken} next: listFiles - returnFiles: return: ${filesWith2025}
How to use
- Deploy the workflow in Google Cloud Workflows.
- Invoke the workflow with your bucket name as the parameter, e.g.:
gcloud workflows run cloud-workflow-list-2025-files --data='{"bucket":"YOUR_BUCKET_NAME"}'
What it does
- Lists all objects in the bucket (handles pagination).
- Filters files whose names contain "2025".
- Returns the list of matching file names.
Let me know if you need a version that takes the bucket name as a hardcoded value, or if you want to filter by a different string!
- You have a bucket named
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.