GitHub Actions
A step at the end of the workflow reports the deploy result. Since the link is a secret, it goes in Secrets, never in the YAML.
- In GGspeak, create a webhook under Integrations, in your deploys channel, and copy the link.
- In the repository, open Settings, Secrets and variables, Actions, and create a secret named
GGSPEAK_WEBHOOKwith the link. - Add the step below to the job.
- name: Notify GGspeak if: always() env: GGSPEAK_WEBHOOK: ${{ secrets.GGSPEAK_WEBHOOK }} JOB_STATUS: ${{ job.status }} RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: | if [ "$JOB_STATUS" = "success" ]; then STATE=ok; else STATE=alert; fi jq -n \ --arg key "deploy-${GITHUB_REF_NAME}-${GITHUB_SHA::8}" \ --arg title "Deploy: ${GITHUB_REF_NAME}" \ --arg state "$STATE" \ --arg body "$GITHUB_REPOSITORY" \ --arg url "$RUN_URL" \ --arg sha "${GITHUB_SHA::8}" \ --arg who "$GITHUB_ACTOR" \ '{key: $key, card: {title: $title, state: $state, body: $body, url: $url, fields: [{name: "Commit", value: $sha}, {name: "Author", value: $who}]}}' \ | curl -fsS --retry 3 -X POST "$GGSPEAK_WEBHOOK" \ -H "Content-Type: application/json" -d @-jq builds the JSON with the quotes escaped, even if the branch name or the author has special characters. The result is the card from the field table:
{ "key": "deploy-master-4856e7ac", "card": { "title": "Deploy: master", "state": "ok", "body": "ggspeak/ggspeak", "url": "https://github.com/ggspeak/ggspeak/actions/runs/11800234567", "fields": [ { "name": "Commit", "value": "4856e7ac" }, { "name": "Author", "value": "rafael" } ] }}One card from start to finish
Section titled “One card from start to finish”To have the card show as “Info” when the deploy starts and turn into “Resolved” at the end, add a step before the deploy with the same key, changing only state to info and the title to “Deploy in progress”. The final step then updates that same card instead of opening another message.