Add failure notification job to deployer workflow#42
Conversation
Adds a job to notify a bot in case of deployment failure.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| runs-on: ubuntu-latest | ||
| needs: [fetch-versions, determine-if-deployment-needed, deploy] | ||
| if: failure() || cancelled() | ||
| steps: | ||
| - name: Send failure notice to deploymentPromoted bot | ||
| env: | ||
| BOT_ENDPOINT: https://deployment-promoted.vercel.app/api/deploymentPromoted | ||
| PROJECT_NAME: v4-web | ||
| LATEST_PATCH: ${{ needs.fetch-versions.outputs.latest-patch-in-line-version }} | ||
| PRODUCTION_VERSION: ${{ needs.fetch-versions.outputs.production-version }} | ||
| run: | | ||
| VERSION_PAYLOAD="$LATEST_PATCH" | ||
| if [ -z "$VERSION_PAYLOAD" ]; then | ||
| VERSION_PAYLOAD="$PRODUCTION_VERSION" | ||
| fi | ||
|
|
||
| curl -X POST "$BOT_ENDPOINT" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "$(jq -n \ | ||
| --arg project "$PROJECT_NAME" \ | ||
| --arg status "failed" \ | ||
| --arg version "$VERSION_PAYLOAD" \ | ||
| --arg workflow_run "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ | ||
| '{project: $project, status: $status, version: $version, meta: {workflow_run: $workflow_run}}')" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix this issue, explicitly limit the permissions at the root of the workflow (.github/workflows/deployer.yml) by setting a permissions: block. Since no step in this workflow appears to require write access to repository contents, secrets, or other sensitive scopes (other than the use of a GitHub App token in the deploy job, which is handled via an app token, not the Actions default token), the safest minimal setting is to declare permissions: read-all at the workflow/root level. If finer granularity is desired, specify only those permissions required (e.g., contents: read); for most workflows, contents: read is enough, and jobs that require more can declare it themselves. For maximal security and future clarity, add the block just after the workflow name: and before the on: key.
No external dependencies or package changes are required.
| @@ -1,4 +1,6 @@ | ||
| name: Deploy new upstream release to Vercel | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| workflow_dispatch: |
pswies
left a comment
There was a problem hiding this comment.
LGTM; please schedule a task to add authentication to the bot
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
* Add failure notification job to deployer workflow Adds a job to notify a bot in case of deployment failure. * Use variable for BOT_ENDPOINT in deployer.yml
Adds a job to notify a bot in case of deployment failure.