Skip to content

Commit

Permalink
[CI] Disable Discord webhook when CI run is cancelled. (qmk#24104)
Browse files Browse the repository at this point in the history
* Disable Discord webhook when CI run is cancelled.

* Include link to binaries in Discord output.
  • Loading branch information
tzarc authored Jul 12, 2024
1 parent c58c5fa commit 4d4d7b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_build_major_branch_keymap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ jobs:
targets-${{ inputs.keymap }}
- name: 'CI Discord Notification'
if: always()
if: always() && !cancelled()
working-directory: util/ci/
env:
DISCORD_WEBHOOK: ${{ secrets.CI_DISCORD_WEBHOOK }}
run: |
python3 -m pip install -r requirements.txt
python3 ./discord-results.py --branch ${{ inputs.branch || github.ref_name }} --keymap ${{ inputs.keymap }} --url ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
python3 ./discord-results.py --branch ${{ inputs.branch || github.ref_name }} --sha $(git rev-parse HEAD) --keymap ${{ inputs.keymap }} --url ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2 changes: 2 additions & 0 deletions util/ci/discord-results.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
parser.add_argument('-b', '--branch')
parser.add_argument('-k', '--keymap')
parser.add_argument('-u', '--url')
parser.add_argument('-s', '--sha')
args = parser.parse_args()

qmk_dir = Path(__file__).resolve().parents[2].resolve()
Expand Down Expand Up @@ -43,6 +44,7 @@

embed.add_embed_field(name='Build Target', value=f'[**{args.branch}**](https://github.com/qmk/qmk_firmware/tree/{args.branch}) / **{args.keymap}** keymap')
embed.add_embed_field(name='Workflow Run', value=f'[**Link**]({args.url})')
embed.add_embed_field(name='Firmware Binaries', value=f'[**ci.qmk.fm**](https://ci.qmk.fm/{args.branch}/{args.sha}/index.html)')
embed.set_timestamp()

webhook.add_embed(embed)
Expand Down

0 comments on commit 4d4d7b7

Please sign in to comment.