Skip to content

Send slack notification #5

Send slack notification

Send slack notification #5

Workflow file for this run

name: Send slack notification
on:
workflow_run:
workflows: [compile, conventions]
types:
- completed
jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'Download artifact'
uses: actions/github-script@v5
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "notification"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/notification.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: |
pwd
unzip notification.zip
- name: 'Send notification'
run: |
pwd
./scripts/githubActions/sendSlackNotification.sh
env:
MESSAGEPATH: ./notificationMessage.txt
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
CHANNEL: pull-requests