-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested keys in JSON payloads can't be accessed in Slack workflows #280
Comments
Hey @rzumer! 👋 Really solid callout and thanks for sending a fix in for it as well. I can confirm this is a limitation in Workflow Builder and your patch is a solid solution! I plan to review the changes soon, but as a workaround for now I suggest individually setting these keys at the top-level of the payload. For example: {
"github_event_name": ${{ github.event_name }},
"github_repository": ${{ github.repository }}
} |
Thanks for the quick response. For a few reasons I won't get into, manually mapping the nested keys would get tedious in my workflows. My plan was to build and run it directly from my branch in a custom action (I went through the steps in my test workflow to validate my PR today), but I don't have an urgent need for it, so hopefully if a fix can be released relatively quickly I can avoid that entirely. Of course having the workflow builder accept periods in variable keys would work too. But I don't think I can send a patch there so I chose the path with the least expected amount of friction :) |
Makes total sense! Checking now to see if the dot notation is something Workflow Builder can support to avoid a possible breaking change for existing workflows that might expect this as a variable input. I think there might be a few out there! I'll keep ya updated on anything I hear with that. If there aren't plans for dot notation, I think your patch is the way to go 🚀 |
I believe I'm running into this but I'm not sure I'm understanding the workaround. Given this:
I was getting an error. If I hard code the payload as:
it works |
@SamuelCox this seems to be from a different cause to me. This issue is more about payloads with attributes that have objects as values. Things like: payload: |
{
"example": {
"value": "12"
}
} Happy to take look into workaround for your workflow in a new issue, but I'm guessing the variable message isn't being quoted properly so JSON parsing is failing. 🤔 The following might help: payload: |
{
"text": ${{ toJSON(inputs.message) }}
} |
Yeah you were right, that fixed it, thank you! Sorry for commenting on an unrelated issue |
Description
This repo uses
flat
for flattening JSON arrays, but by default nested keys are delimited with periods. Periods are not allowed in variable fields in Slack workflows, so it's impossible to reference those keys from flattened payloads.What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)The text was updated successfully, but these errors were encountered: