Skip to content

Behaviour of custom safe outputs inputs not matching docs #11529

@dsyme

Description

@dsyme

I'm looking in to a bug in safe-outputs

Trying to understand if it's a bug in docs, implementation, or test,

I'm following instructions here: https://githubnext.github.io/gh-aw/guides/custom-safe-outputs/

But inputs.message is not being set. Equally I can't quite see who/what should be setting this. Wondering if docs are wrong.

Workflow is here: https://github.com/githubnext/gh-aw-test/blob/main/.github/workflows/test-claude-safe-jobs.md?plain=1

---
on: 
  workflow_dispatch:

permissions: read-all

engine: claude

safe-outputs:
  jobs:
    print:
      #name: "print the message"
      runs-on: ubuntu-latest
      inputs:
        message:
          description: "Message to print"
          required: true
          type: string
      steps:
        - name: print message
          env:
            MESSAGE: "${{ inputs.message }}"
          run: |
              if [ -z "$MESSAGE" ]; then
                echo "Error: message is empty"
                exit 1
              fi
              echo "print: $MESSAGE"
              echo "### Print Step Summary" >> "$GITHUB_STEP_SUMMARY"
              echo "$MESSAGE" >> "$GITHUB_STEP_SUMMARY"    
            
---
Summarize and use print the message using the `print` tool.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lock file here: https://github.com/githubnext/gh-aw-test/blob/main/.github/workflows/test-claude-safe-jobs.lock.yml?plain=1

Looking at other examples uses of inputs: in safe outputs in gh-aw files, they seem to process like this:
const outputContent = process.env.GH_AW_AGENT_OUTPUT;

....
Ian't find an example that goes via inputs like the docs say

I'm asking what the spec is.

Question is whether it is it right to expect this to work, as it says in the docs:
env:
MESSAGE: "${{ inputs.message }}"

This seems unlikely. Inputs is reserved for workflow inputs as far as I can tell. I think the docs have been hallucinated here.

AFAICS all that is available is GH_AW_AGENT_OUTPUT env var and the use code must process that.

I won't fix it just yet, will write it up as an issue for your guidance on how the safe output job gets the agent output.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentationworkflows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions