mirror of
https://github.com/Xithrius/twitch-tui.git
synced 2024-09-11 13:45:30 +03:00
Status embeds was broken on other branches besides main, now artifacts are always checked
This commit is contained in:
parent
e70df63273
commit
55d76989a5
23
.github/workflows/ci.yml
vendored
23
.github/workflows/ci.yml
vendored
@ -57,3 +57,26 @@ jobs:
|
|||||||
|
|
||||||
- name: Check code for possible improvements
|
- name: Check code for possible improvements
|
||||||
run: cargo clippy -- -D warnings
|
run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
|
||||||
|
# Prepare the Pull Request Payload artifact. If this fails, we
|
||||||
|
# we fail silently using the `continue-on-error` option. It's
|
||||||
|
# nice if this succeeds, but if it fails for any reason, it
|
||||||
|
# does not mean that our lint-test checks failed.
|
||||||
|
- name: Prepare Pull Request Payload artifact
|
||||||
|
id: prepare-artifact
|
||||||
|
if: always() && github.event_name == 'pull_request'
|
||||||
|
continue-on-error: true
|
||||||
|
run: cat $GITHUB_EVENT_PATH | jq '.pull_request' > pull_request_payload.json
|
||||||
|
|
||||||
|
# This only makes sense if the previous step succeeded. To
|
||||||
|
# get the original outcome of the previous step before the
|
||||||
|
# `continue-on-error` conclusion is applied, we use the
|
||||||
|
# `.outcome` value. This step also fails silently.
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
if: always() && steps.prepare-artifact.outcome == 'success'
|
||||||
|
continue-on-error: true
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: pull-request-payload
|
||||||
|
path: pull_request_payload.json
|
||||||
|
29
.github/workflows/status_embed.yml
vendored
29
.github/workflows/status_embed.yml
vendored
@ -7,13 +7,34 @@ on:
|
|||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
status_embed:
|
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 CI workflow,
|
||||||
|
# as the sequence always terminates with one run.
|
||||||
|
#
|
||||||
|
# 3. If any workflow ends in failure or was cancelled.
|
||||||
|
if: >-
|
||||||
|
github.event.workflow_run.event == 'pull_request' ||
|
||||||
|
github.event.workflow_run.conclusion == 'failure' ||
|
||||||
|
github.event.workflow_run.conclusion == 'cancelled'
|
||||||
name: Send Status Embed to Discord
|
name: Send Status Embed to Discord
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Process the artifact uploaded in the `pull_request`-triggered workflow:
|
# A workflow_run event does not contain all the information
|
||||||
|
# we need for a PR embed. That's why we upload an artifact
|
||||||
|
# with that information in the Lint workflow.
|
||||||
- name: Get Pull Request Information
|
- name: Get Pull Request Information
|
||||||
id: pr_info
|
id: pr_info
|
||||||
if: github.event.workflow_run.event == 'pull_request'
|
if: github.event.workflow_run.event == 'pull_request'
|
||||||
@ -38,12 +59,11 @@ jobs:
|
|||||||
- name: GitHub Actions Status Embed for Discord
|
- name: GitHub Actions Status Embed for Discord
|
||||||
uses: SebastiaanZ/github-status-embed-for-discord@main
|
uses: SebastiaanZ/github-status-embed-for-discord@main
|
||||||
with:
|
with:
|
||||||
# Webhook token
|
# Our GitHub Actions webhook
|
||||||
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
||||||
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
||||||
|
|
||||||
# We need to provide the information of the workflow that
|
# Workflow information
|
||||||
# triggered this workflow instead of this workflow.
|
|
||||||
workflow_name: ${{ github.event.workflow_run.name }}
|
workflow_name: ${{ github.event.workflow_run.name }}
|
||||||
run_id: ${{ github.event.workflow_run.id }}
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
run_number: ${{ github.event.workflow_run.run_number }}
|
run_number: ${{ github.event.workflow_run.run_number }}
|
||||||
@ -53,7 +73,6 @@ jobs:
|
|||||||
ref: ${{ github.ref }}
|
ref: ${{ github.ref }}
|
||||||
sha: ${{ github.event.workflow_run.head_sha }}
|
sha: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
|
||||||
# Now we can use the information extracted in the previous step:
|
|
||||||
pr_author_login: ${{ steps.pr_info.outputs.pr_author_login }}
|
pr_author_login: ${{ steps.pr_info.outputs.pr_author_login }}
|
||||||
pr_number: ${{ steps.pr_info.outputs.pr_number }}
|
pr_number: ${{ steps.pr_info.outputs.pr_number }}
|
||||||
pr_title: ${{ steps.pr_info.outputs.pr_title }}
|
pr_title: ${{ steps.pr_info.outputs.pr_title }}
|
||||||
|
Loading…
Reference in New Issue
Block a user