Skip to content

⛓ Here's your serverless solution for sending build status from GitLab CI to Discord as webhooks.

License

Notifications You must be signed in to change notification settings

Joshuaharry120/gitlab-ci-discord-webhook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitLab CI 🡒 Discord Webhook

Backers on Open Collective Sponsors on Open Collective

If you are looking for a way to get build (success/fail) status reports from GitLab CI in Discord, stop looking. You've came to the right place.

Requirements

  • You should be using GitLab CI.
  • A Discord Server where notifications will be posted.
  • 5 minutes
  • A cup of coffee ☕

Guide

  1. Create a webhook in your Discord Server (Guide).

  2. Copy the Webhook URL.

  3. Go to your repository CI/CD settings (for which you want status notifications) in GitLab and add an environment variable called WEBHOOK_URL and paste the Webhook URL you got in the previous step.

    Add environment variable in GitLab See: https://docs.gitlab.com/ee/ci/variables/#via-the-ui

  4. Add these lines, in their appropriate locations, to the .gitlab-ci.yml file of your repository.

    stages:
      - notification
    success_notification:
      stage: notification
      script:
        - wget https://raw.githubusercontent.com/DiscordHooks/gitlab-ci-discord-webhook/master/send.sh
        - chmod +x send.sh
        - ./send.sh success $WEBHOOK_URL
      when: on_success
    failure_notification:
      stage: notification
      script:
        - wget https://raw.githubusercontent.com/DiscordHooks/gitlab-ci-discord-webhook/master/send.sh
        - chmod +x send.sh
        - ./send.sh failure $WEBHOOK_URL
      when: on_failure
  5. Grab your coffee ☕ and enjoy! And, if you liked this, please ⭐Star this repository to show your love.

Note

  • If within your gitlab CI Code, you have a pause within the script code, this notiction yml code will still run, to fix this, we need to add allow_failure: false, this will mean the job will not run unless told to(see screenshot)

  • If you face any issues in the scripts (and you're sure it's not on your side), please consider opening an issue and I'll fix it ASAP.

  • If you want to improve the scripts, feel free to open a pull request.

See Also

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

About

⛓ Here's your serverless solution for sending build status from GitLab CI to Discord as webhooks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%