-
Notifications
You must be signed in to change notification settings - Fork 481
Add deployment_status trigger guidance to create-agentic-workflow prompt
#18274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e71e7bc
9572740
f3ff02a
4913808
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot format this file as a prompt, not an agentic workflow
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 4913808 — reformatted as a prompt with just |
||
| description: Reference pattern for monitoring external deployment failures using the deployment_status trigger and creating incident issues automatically. | ||
| --- | ||
|
|
||
| # Deployment Status Monitoring | ||
|
|
||
| Consult this file when creating an agentic workflow that responds to external deployment failures from services like Heroku, Vercel, Railway, or Fly.io that post deployment status back to GitHub. | ||
|
|
||
| ## Trigger and Frontmatter | ||
|
|
||
| Use the `deployment_status` trigger with an `if:` condition to filter to failed deployments only: | ||
|
|
||
| ```yaml | ||
| on: | ||
| deployment_status: | ||
| if: ${{ github.event.deployment_status.state == 'failure' }} | ||
| permissions: | ||
| contents: read | ||
| issues: read | ||
| deployments: read | ||
|
Comment on lines
+13
to
+20
|
||
| tools: | ||
| github: | ||
| toolsets: [default] | ||
| safe-outputs: | ||
| create-issue: | ||
| expires: 1d | ||
| title-prefix: "[Deployment Failure] " | ||
| close-older-issues: true | ||
| noop: | ||
| ``` | ||
|
|
||
| ## Available Event Context | ||
|
|
||
| The following expressions are available in the prompt body: | ||
|
|
||
| | Expression | Description | | ||
| |---|---| | ||
| | `${{ github.event.deployment.environment }}` | Target environment (e.g. `production`) | | ||
| | `${{ github.event.deployment_status.state }}` | Status (`failure`, `success`, `error`, etc.) | | ||
| | `${{ github.event.deployment_status.target_url }}` | URL to the external service deployment logs | | ||
|
Comment on lines
+36
to
+40
|
||
| | `${{ github.event.deployment_status.description }}` | Human-readable error message from the service | | ||
| | `${{ github.event.deployment.ref }}` | Branch or tag that was deployed | | ||
| | `${{ github.event.deployment.sha }}` | Commit SHA that was deployed | | ||
| | `${{ github.event.deployment.creator.login }}` | GitHub user who triggered the deployment | | ||
|
|
||
| ## Agent Instructions Pattern | ||
|
|
||
| ```markdown | ||
| A deployment to **${{ github.event.deployment.environment }}** has failed. | ||
|
|
||
| 1. **Verify the failure**: Confirm `${{ github.event.deployment_status.state }}` is `failure`. If not, call `noop` and stop. | ||
| 2. **Gather context**: Review ref (`${{ github.event.deployment.ref }}`), SHA (`${{ github.event.deployment.sha }}`), and error description (`${{ github.event.deployment_status.description }}`). | ||
| 3. **Check for duplicates**: Search open issues with the `[Deployment Failure]` title prefix. | ||
| 4. **Create an incident issue** if none exists, including environment, ref/SHA, deployment URL, error details, and suggested next steps. | ||
|
|
||
| Use `noop` if the deployment did not fail or a duplicate issue already exists. | ||
| ``` | ||
|
|
||
| ## When to Use `deployment_status` vs `workflow_run` | ||
|
|
||
| - **`deployment_status`**: External services (Heroku, Vercel, Railway, Fly.io) that integrate with the GitHub Deployments API — they post a deployment status event back to GitHub when a deploy finishes. | ||
| - **`workflow_run`**: In-repo GitHub Actions pipelines — use when reacting to the success or failure of another Actions workflow in the same repository. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guidance filters only on
github.event.deployment_status.state == 'failure', but deployment statuses may also report unsuccessful deployments aserror. To avoid missing failures from external providers, consider updating the recommended condition to include bothfailureanderror(or a non-success check).