-
Notifications
You must be signed in to change notification settings - Fork 3
Add a reusable status_embed workflow #17
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
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,55 @@ | ||
| name: Status Embed | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| job_status: | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| webhook_token: | ||
| required: true | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| status_embed: | ||
| # We need to send a status embed whenever the workflow | ||
| # sequence we're running terminates. There are a number | ||
| # of situations in which that happens: | ||
| # | ||
| # 1. We reach the end of the Deploy workflow, without | ||
| # it being skipped. | ||
| # | ||
| # 2. A `pull_request` triggered a Lint & Test workflow, | ||
| # as the sequence always terminates with one run. | ||
| # | ||
| # 3. If any workflow ends in failure or was cancelled. | ||
| if: >- | ||
| (github.workflow == 'Deploy' && ${{ inputs.job_status }} != 'skipped') || | ||
| github.event_name == 'pull_request' || | ||
| ${{ inputs.job_status }} == 'failure' || | ||
| ${{ inputs.job_status }} == 'cancelled' | ||
| name: Send Status Embed to Discord | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # Send an informational status embed to Discord instead of the | ||
| # standard embeds that Discord sends. This embed will contain | ||
| # more information and we can fine tune when we actually want | ||
| # to send an embed. | ||
| - name: GitHub Actions Status Embed for Discord | ||
| uses: SebastiaanZ/github-status-embed-for-discord@v0.3.0 | ||
| with: | ||
| # Our GitHub Actions webhook | ||
| webhook_id: '784184528997842985' | ||
|
Member
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. This should be an input, so the caller can determine what channel it gets sent to
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. I think setting it as a variable is better, that way we'd avoid having the At worst, we can have it as an input, and default to the variable. But shouldn't be needed in our case |
||
| webhook_token: ${{ secrets.webhook_token }} | ||
|
|
||
| # Workflow information | ||
| status: ${{ inputs.job_status }} | ||
| pr_author_login: ${{ github.event.pull_request.user.login}} | ||
| pr_number: ${{ github.event.pull_request.number }} | ||
| pr_title: ${{ github.event.pull_request.title }} | ||
| pr_source: ${{ github.event.pull_request.head.label }} | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
The
Deployname here won't be the same on all repos. We should make this an input, or standardise the name across our repos as part of the work to use this.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.
How about we go for the standardization option?