项目作者: eonx-com

项目描述 :
Github Actions: OpsGenie Alerting
高级语言: Shell
项目地址: git://github.com/eonx-com/actions-opsgenie.git
创建时间: 2019-11-25T23:19:13Z
项目社区:https://github.com/eonx-com/actions-opsgenie

开源协议:

下载


Github Actions: OpsGenie

This Github action can be used to generate alert to OpsGenie by generating a CURL request to the OpsGenie API.

Required Parameters

  • ALIAS

    User defined identifier for the alert (this is used by OpsGenie to de-duplicate alerts)

  • MESSAGE

    The content of the alert message

  • PRIORITY

    The priority level of the alert (one of the pre-defined OpsGenie levels: P1, P2, P3, P4, P5)

  • API_KEY

    The OpsGenie API key (this will need to be pre-configured via the OpsGenie website)

Optional Parameters

  • USE_EU_INSTANCE

    Use the EU instance of OpsGenie

Example Usage

The following example shows how the action can be used in a Github workflow file. This sends a P5 notification on start
of deployment, and then generates another P5 notification on successful deployment- or a P1 alert on failure

  1. name: Deploy Production Environment
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. deploy-production-start:
  8. name: Start Notification
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Send OpsGenie Alert
  12. uses: eonx-com/actions-opsgenie@master
  13. with:
  14. API_KEY: ${{ secrets.OPSGENIE_API_KEY }}
  15. PRIORITY: 'P5'
  16. ALIAS: 'deploy-production'
  17. MESSAGE: 'Deployment to production started'
  18. deploy-production:
  19. name: Deploy (Production)
  20. runs-on: ubuntu-latest
  21. steps:
  22. ...
  23. Deployment logic here
  24. ...
  25. deploy-production-success:
  26. name: Success Notification
  27. needs: deploy-production
  28. if: success()
  29. runs-on: ubuntu-latest
  30. steps:
  31. - name: Send OpsGenie Alert
  32. uses: eonx-com/actions-opsgenie@master
  33. with:
  34. API_KEY: ${{ secrets.OPSGENIE_API_KEY }}
  35. PRIORITY: 'P5'
  36. ALIAS: 'deploy-production'
  37. MESSAGE: 'Deployment to production completed successfully'
  38. deploy-production-failed:
  39. name: Failed Notification
  40. needs: deploy-production
  41. if: failure()
  42. runs-on: ubuntu-latest
  43. steps:
  44. - name: Send OpsGenie Alert
  45. uses: eonx-com/actions-opsgenie@master
  46. with:
  47. API_KEY: ${{ secrets.OPSGENIE_API_KEY }}
  48. PRIORITY: 'P1'
  49. ALIAS: 'deploy-production-failed'
  50. MESSAGE: 'Deployment to production failed. please review Github Actions logs'