Skip to content
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

Support custom variable interpolation in payload JSON file #150

Closed
4 of 10 tasks
adaminglehart opened this issue Nov 17, 2022 · 6 comments
Closed
4 of 10 tasks

Support custom variable interpolation in payload JSON file #150

adaminglehart opened this issue Nov 17, 2022 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@adaminglehart
Copy link

Description

With the current implementation, it seems like the only variables that can be interpolated into the message payload are the ones from the github context object. It'd be really helpful to be able to pass in custom variables besides just what's available in there. Ideally you'd be able to just use anything in the env object but it doesn't seem like the github actions SDK allows you to access that? In that case I'd propose allowing something like a vars input that, if provided, will be accessible in your payload. Something like:

action.yml

env:
  myCustomVar: abc123

...

- name: Post slack message
  id: slack
  uses: slackapi/[email protected]
  with:
    channel-id: ${{env.channel_id}}
    payload-file-path: "./my-payload.json"
    vars: |
      {
        myVar: ${{env.myCustomVar}},
        application: Backend
      } 

my-payload.json

{
  "text": "{{{vars.application}}} deploy - {{vars.myvar}}"
}

I'm happy to take a pass at the implementation but wanted to verify that this would be of interest first

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
@seratch seratch added enhancement New feature or request good first issue Good for newcomers labels Nov 17, 2022
@seratch seratch added this to the 1.x milestone Nov 17, 2022
@seratch
Copy link
Member

seratch commented Nov 17, 2022

Hi @adaminglehart, thanks for sharing the suggestions. Our team will look into it sometime soon. If anyone has ideas or thoughts on this, please share them by posting comments here 👋

@adaminglehart
Copy link
Author

hi @seratch, just checking if your team had a chance to review this proposal? Like I mentioned, I'm happy to do the implementation, I'd just want to have an idea whether or not it would be accepted first

@seratch
Copy link
Member

seratch commented Dec 6, 2022

@adaminglehart Thanks for the reminder. Some members in our team are interested in this enhancement!

I myself have a little hesitation to introduce a custom mechanism in addition to GitHub Actions platform features. My concern here is that our own feature addition may become a technical debt in the future when GH Actions adds something similar. Also, I am wondering if the implementation can be simple and easy to maintain in the long run.

If you have already implemented something similar in the past, could you share the code with us first? With that, we may be more confident on this enhancement.

@jcastello-hv
Copy link

jcastello-hv commented Jan 10, 2023

It looks like this PR might cover this case.

Fixed to be able to use env of Step #159

@filmaj filmaj modified the milestones: 1.x, 1.24 May 17, 2023
@filmaj
Copy link
Contributor

filmaj commented May 17, 2023

We tackled this issue in #200.

@filmaj
Copy link
Contributor

filmaj commented May 17, 2023

Release v1.24.0 is out!

@filmaj filmaj closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants