Skip to content

jenkins: Learn how to set up Jenkins and add a call to the deploys API #15

jenkins: Learn how to set up Jenkins and add a call to the deploys API

jenkins: Learn how to set up Jenkins and add a call to the deploys API #15

name: Post Slack message
on:
push:
branches:
- main
paths:
- 'data/scorecards/**'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
- name: Post Slack Message
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -o pipefail # Do not want step to exit if grep gets a return code of 1.
message="Updated content has been published to <https://github.com/${GITHUB_REPOSITORY}|Learn Cortex>\n"
message="${message}*Description*: ${{ github.event.head_commit.message }}\n"
message="${message}*Submitted by*: ${GITHUB_ACTOR}\n"
for file in ${ALL_CHANGED_FILES}; do
message="${message}*File:* <https://github.com/${GITHUB_REPOSITORY}/blob/main/$file|$file> was changed\n"
done
grep "Author: None" ${file} >/dev/null 2>&1
if [ $? -eq 0 ]; then
message="${message}\nThis is an unwritten scorecard that is looking for an owner.\n"
fi
echo "message = ${message}"
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${message}\"}" ${{ env.SLACK_WEBHOOK_URL }}