Skip to content

Commit 7a7497b

Browse files
committed
build: migrate to Zulip for workflow notification
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent c11a9fe commit 7a7497b

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

.github/workflows/standalone_publish.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ jobs:
137137
/tmp/stdlib_ordered_pkg_list.json
138138
/tmp/stdlib_published_pkg_list.json
139139
140-
# Define a job for sending notifications to Slack...
141-
slack:
140+
# Define a job for sending notifications to Zulip...
141+
zulip:
142142

143143
# Define a display name:
144-
name: 'Slack notification'
144+
name: 'Zulip notification'
145145

146146
# Define the type of virtual host machine:
147147
runs-on: 'ubuntu-latest'
@@ -164,31 +164,36 @@ jobs:
164164
# Resolve notification data:
165165
- name: 'Resolve notification data'
166166
run: |
167-
echo 'NOTIFICATION_STATUS=${{ needs.publish.result}}' >> $GITHUB_ENV
168167
if [[ "${{ needs.publish.result }}" = "success" ]]; then
169-
echo 'NOTIFICATION_TEXT=**standalone_publish** workflow succeeded' >> $GITHUB_ENV
170-
echo 'NOTIFICATION_AUTHOR_NAME=Success' >> $GITHUB_ENV
168+
echo 'NOTIFICATION_ICON=:check:' >> $GITHUB_ENV
169+
echo 'NOTIFICATION_STATUS=succeeded' >> $GITHUB_ENV
171170
elif [[ "${{ needs.publish.result }}" = "failure" ]]; then
172-
echo 'NOTIFICATION_TEXT=**standalone_publish** workflow failed' >> $GITHUB_ENV
173-
echo 'NOTIFICATION_AUTHOR_NAME=Failure' >> $GITHUB_ENV
171+
echo 'NOTIFICATION_ICON=:cross_mark:' >> $GITHUB_ENV
172+
echo 'NOTIFICATION_STATUS=failed' >> $GITHUB_ENV
174173
elif [[ "${{ needs.publish.result }}" = "cancelled" ]]; then
175-
echo 'NOTIFICATION_TEXT=**standalone_publish** workflow was canceled' >> $GITHUB_ENV
176-
echo 'NOTIFICATION_AUTHOR_NAME=Canceled' >> $GITHUB_ENV
174+
echo 'NOTIFICATION_ICON=:warning:' >> $GITHUB_ENV
175+
echo 'NOTIFICATION_STATUS=was canceled' >> $GITHUB_ENV
177176
else
178177
exit 1
179178
fi
180179
timeout-minutes: 5
181180

182-
# Send notification to Slack:
181+
# Send notification to Zulip:
183182
- name: 'Send notification'
184183
# Pin action to full length commit SHA
185-
uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0
184+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
186185
if: success()
187186
with:
188-
status: "${{ env.NOTIFICATION_STATUS }}"
189-
fields: repo,commit,message
190-
text: "${{ env.NOTIFICATION_TEXT }}"
191-
author_name: "${{ env.NOTIFICATION_AUTHOR_NAME }}"
192-
env:
193-
SLACK_WEBHOOK_URL: ${{ secrets.REPO_SLACK_WEBHOOK_URL }}
187+
api-key: ${{ secrets.ZULIP_API_KEY }}
188+
email: 'github-actions-bot@stdlib.zulipchat.com'
189+
organization-url: 'https://stdlib.zulipchat.com'
190+
to: 'workflows'
191+
type: 'stream'
192+
topic: 'standalone-publish'
193+
content: |
194+
${{ env.NOTIFICATION_ICON }} **standalone_publish** workflow ${{ env.NOTIFICATION_STATUS }}
195+
196+
**Commit:** [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
197+
**Message:** ${{ github.event.head_commit.message }}
198+
**Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
194199
timeout-minutes: 5

0 commit comments

Comments
 (0)