Skip to content

Mattermost multiline #32

Mattermost multiline

Mattermost multiline #32

name: Builds-Mastodon
on:
workflow_call:
secrets:
MASTODON_URL:
required: true
MASTODON_ACCESS_TOKEN:
required: true
push:
branches:
- main
jobs:
notify:
name: Mastodon
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v3
- name: Set Icons
env:
STATUS: ${{ env.WORKFLOW_CONCLUSION }}
run: |
ICON=":white_check_mark:"
if [ "${STATUS}" == "failure" ]; then
ICON=":red_circle:"
fi
export ICON
echo "ICON=\"${ICON}\"" >> $GITHUB_ENV
- name: Trim Body
shell: bash
run: |
BODYLINE='${{ toJSON(github.event.head_commit.message) }}'
BODYLINE="${BODYLINE#\"}"
BODYLINE="${BODYLINE%\"}"
TRIMMED_BODY="${BODYLINE:0:350}"
echo "BODY=${TRIMMED_BODY}" >> $GITHUB_ENV
- name: Send toot to Mastodon
id: mastodon
continue-on-error: true
uses: cbrgm/mastodon-github-action@v1
env:
REPOSITORY: ${{ github.repository }}
REPOSITORY_URL: ${{ github.repository.html_url }}
REF: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
BODY: ${{ github.env.BODY }}
STATUS: ${{ env.WORKFLOW_CONCLUSION }}
MASTODON_URL: ${{ secrets.MASTODON_URL }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
LINK: ${{ github.event.head_commit.url }}
with:
message: |
${{ env.REPOSITORY }} build by ${{ env.ACTOR }}
Branch: ${{ env.REF }}
Status: ${{ env.icon }} ${{ env.STATUS }}
${{ env.BODY }}
${{ env.LINK }}
visibility: "public"