Apply changes 183 #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Send Zulip message | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
send-push-info-to-zulip: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout files | |
with: | |
fetch-depth: '2' | |
persist-credentials: 'true' | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
const commits = ${{ toJSON(github.event.commits) }} | |
for (const commit of commits) { | |
console.log(commit); | |
}; | |
const event = ${{ toJSON(github.event) }}; | |
console.log(event); | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
- name: Get branch name | |
id: branchname | |
run: | | |
BRANCH=$(echo ${{github.event.ref}} | cut -d'/' -f3) | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
- name: Get ISO code | |
id: isocode | |
run: | | |
ISO=$(echo ${{github.event.repository.name}} | cut -d'-' -f2- | sed -e 's/-.*private.*$/-priv/' | sed '/-priv/!s/-.*//') | |
echo "ISO=$ISO" >> $GITHUB_ENV | |
- name: Logging | |
id: log | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "text<<$EOF" >> $GITHUB_OUTPUT | |
for file in ${{steps.changed-files.outputs.all_modified_files}} ; do | |
echo "- $file" >> $GITHUB_OUTPUT | |
done | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Send a stream message | |
uses: zulip/github-actions-zulip/send-message@v1 | |
with: | |
api-key: ${{ secrets.ZULIP_API_KEY }} | |
email: "github-bot@giella.zulipchat.com" | |
organization-url: "https://giella.zulipchat.com" | |
to: "${{env.ISO}}" | |
type: "stream" | |
topic: "${{github.event.repository.name}} / ${{env.BRANCH}}" | |
content: "${{github.event.pusher.name}} [pushed](${{github.event.compare}}) to branch ${{env.BRANCH}}.\n\n##### - ${{github.event.commits[0].message}}\n---\n##### Changed files:\n\n${{steps.log.outputs.text}}" |