Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

Make a cloud workflows yaml that list all the files in cloud storage containing 2025

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-opus-4-20250514’s answer.
  1. User

    Make a cloud workflows yaml that list all the files in cloud storage containing 2025

  2. 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_token for 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

    1. Deploy the workflow in Google Cloud Workflows.
    2. 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!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.