question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use GitHub environment variables in the Discord message

See original GitHub issue

Hi! I was trying to add the commit SHA to the Discord message using the env.GITHUB_SHA GitHub environment variable. But no matter how I tried to do this, it never worked out.
I want to achieve a message like this:

CI run was successful.
https://github.com/Sv443/Project/[COMMIT_SHA_HERE]/actions

I’ve never really used bash, nor did I ever use this GitHub action, so please tell me how I could achieve this or whether you could add this feature.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Sv443commented, Nov 17, 2019

I’ve implemented the GITHUB_SHA variable to directly link to the action log:

    - name: Discord success notification # sends a Discord notification
      env:
        DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
      uses: Ilshidur/action-discord@master
      with:
        args: '☑️ JokeAPI CI run was successful (https://github.com/Sv443/JokeAPI/commit/{{GITHUB_SHA}}/checks)' 
    - name: Discord failure notification # sends a Discord notification
      env:
        DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
      uses: Ilshidur/action-discord@master
      with:
        args: '🚫 JokeAPI CI run failed (https://github.com/Sv443/JokeAPI/commit/{{GITHUB_SHA}}/checks)'
      if: failure()

and it works perfectly! Thanks! 😀

grafik

2reactions
Ilshidurcommented, Nov 17, 2019

I pushed a release. You can now interpolate environment variables in your arguments. More details here : https://github.com/Ilshidur/action-discord#arguments

I’d be glad to hear some feedback from you 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marketplace Actions Actions for Discord - GitHub
Outputs a message to Discord. ... Discord for GitHub Actions ... Environment variables can be interpolated in the message using brackets ( {{...
Read more >
GitHub - Ilshidur/action-discord
Contribute to Ilshidur/action-discord development by creating an account on ... Environment variables can be interpolated in the message using brackets ...
Read more >
discordjs-bot-guide/env-files.md at master - GitHub
Using Environment Variables. A .env file is a type of file that holds environment variables of an application. Environment variables allow you to...
Read more >
Actions Status Discord - GitHub Marketplace
Environment Variables ​​ Discord webhook endpoind like: https://discordapp.com/api/webhooks/... You can provide webhook via inputs either. DO NOT APPEND /github ...
Read more >
Discord Message Notify · Actions · GitHub Marketplace
GitHub Action for sending a Discord notification message. Actions Status. message. Features. Send Multiple Messages; Send Multiple Files ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found