commands.json.example 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {
  2. "$schema": "https://json-schema.org/draft-07/schema#",
  3. "description": "Command configuration for webhook events. Available variables: {{repo}}, {{full_repo}}, {{branch}}, {{pusher}}, {{event}}, {{commit}}, {{commit_msg}}, {{pr_number}}, {{pr_action}}, {{tag}}, {{ref_type}}, {{issue_number}}, {{issue_title}}, {{issue_action}}, {{issue_body}}, {{comment_body}}",
  4. "commands": {
  5. "push": [
  6. {
  7. "name": "echo-push-event",
  8. "description": "Simple echo command for push events",
  9. "type": "shell",
  10. "command": "echo",
  11. "args": ["Push to {{branch}} by {{pusher}} in {{repo}}"],
  12. "cwd": null,
  13. "timeout": 300000,
  14. "filterBranch": null
  15. },
  16. {
  17. "name": "deploy-production",
  18. "description": "Deploy to production on main branch",
  19. "type": "shell",
  20. "command": "/path/to/deploy.sh",
  21. "args": ["{{branch}}", "{{repo}}", "{{pusher}}"],
  22. "cwd": "/workspace",
  23. "timeout": 600000,
  24. "filterBranch": "main"
  25. }
  26. ],
  27. "pull_request": [
  28. {
  29. "name": "pr-notification",
  30. "description": "Notify team about pull requests",
  31. "type": "shell",
  32. "command": "echo",
  33. "args": ["PR #{{pr_number}} {{pr_action}} by {{pusher}}"],
  34. "cwd": null,
  35. "timeout": 300000,
  36. "filterBranch": null
  37. }
  38. ],
  39. "create": [
  40. {
  41. "name": "branch-created",
  42. "description": "Handle new branch or tag creation",
  43. "type": "shell",
  44. "command": "echo",
  45. "args": ["Created {{ref_type}} {{branch}} in {{repo}}"],
  46. "cwd": null,
  47. "timeout": 300000,
  48. "filterBranch": null
  49. }
  50. ],
  51. "delete": [
  52. {
  53. "name": "branch-deleted",
  54. "description": "Handle branch or tag deletion",
  55. "type": "shell",
  56. "command": "echo",
  57. "args": ["Deleted {{ref_type}} {{branch}} from {{repo}}"],
  58. "cwd": null,
  59. "timeout": 300000,
  60. "filterBranch": null
  61. }
  62. ],
  63. "release": [
  64. {
  65. "name": "release-notification",
  66. "description": "Handle release events",
  67. "type": "shell",
  68. "command": "echo",
  69. "args": ["Release {{tag}} {{pr_action}} in {{repo}}"],
  70. "cwd": null,
  71. "timeout": 300000,
  72. "filterBranch": null
  73. }
  74. ],
  75. "issues": [
  76. {
  77. "name": "issue-notification",
  78. "description": "Notify team about issues",
  79. "type": "shell",
  80. "command": "echo",
  81. "args": ["Issue #{{issue_number}} {{issue_action}} by {{pusher}} in {{repo}}: {{issue_title}}"],
  82. "cwd": null,
  83. "timeout": 300000,
  84. "filterBranch": null
  85. },
  86. {
  87. "name": "triage-issue",
  88. "description": "Auto-triage issues with a script",
  89. "type": "shell",
  90. "command": "/path/to/triage-issue.sh",
  91. "args": ["{{repo}}", "{{issue_number}}", "{{issue_body}}"],
  92. "cwd": null,
  93. "timeout": 300000,
  94. "filterBranch": null
  95. },
  96. {
  97. "name": "process-issue-with-node",
  98. "description": "Process issue with Node.js script",
  99. "type": "node",
  100. "command": "./scripts/process-issue.js",
  101. "args": ["--repo", "{{repo}}", "--issue", "{{issue_number}}", "--action", "{{issue_action}}"],
  102. "cwd": null,
  103. "timeout": 300000,
  104. "filterBranch": null
  105. }
  106. ],
  107. "issue_comment": [
  108. {
  109. "name": "comment-notification",
  110. "description": "Handle issue comments",
  111. "type": "shell",
  112. "command": "echo",
  113. "args": ["Comment on issue #{{issue_number}} by {{pusher}}: {{comment_body}}"],
  114. "cwd": null,
  115. "timeout": 300000,
  116. "filterBranch": null
  117. },
  118. {
  119. "name": "check-comment-commands",
  120. "description": "Check for special commands in comments",
  121. "type": "shell",
  122. "command": "/path/to/check-comment-commands.sh",
  123. "args": ["{{comment_body}}", "{{issue_number}}"],
  124. "cwd": null,
  125. "timeout": 300000,
  126. "filterBranch": null
  127. }
  128. ],
  129. "global": [
  130. {
  131. "name": "log-all-events",
  132. "description": "Log all webhook events (runs for every event)",
  133. "type": "shell",
  134. "command": "echo",
  135. "args": ["Webhook {{event}} received for {{repo}}"],
  136. "cwd": null,
  137. "timeout": 300000,
  138. "filterBranch": null
  139. }
  140. ]
  141. }
  142. }