Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Using a GitHub env variable for the To: field #214

Open
peluse opened this issue Sep 5, 2024 · 1 comment
Open

Using a GitHub env variable for the To: field #214

peluse opened this issue Sep 5, 2024 · 1 comment

Comments

@peluse
Copy link

peluse commented Sep 5, 2024

I submitted this before as it didn't work, I saw your comment. My goal was to email specific attachments to the Author when the job fails (not all the logs just things I want to send).

FYI I was able to make it work by doing this:

YAML:
echo "USER_EMAIL=$(git log -1 HEAD | grep -m 1 -E -o '[[:alnum:].-]+@[[:alnum:].-]+.[[:alnum:]]{2,}')" >> $GITHUB_ENV

Change I make in your code:

from:
const to = core.getInput("to", { required: true })
to:
const to = process.env.USER_EMAIL

as getInput() simply wouldn't access the env. Seems like it only works with built-in vars like secrets. Anyway, not sure how valid this hack is but wanted to share. Feel free to close :)

@dawidd6
Copy link
Owner

dawidd6 commented Sep 5, 2024

Can't you just use ${{ env.USER_EMAIL }}?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants