docs: use short form of duration #9
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: Cluster Scanner | |
on: | |
# For test purposes. Trigger the pipeline on pushes to the cluster-scanner branch. | |
push: | |
branches: | |
- cluster-scanner | |
# It runs every Friday, 9:30 UTC. The schedule job only works if the workflow is available in the main branch. | |
schedule: | |
- cron: "30 9 * * 5" | |
workflow_dispatch: | |
env: | |
PALETTE_API_KEY: ${{ secrets.PALETTE_API_KEY }} | |
PALETTE_HOST: ${{ secrets.PALETTE_HOST }} | |
PALETTE_PROJECT_UID: ${{ secrets.PALETTE_PROJECT_UID }} | |
jobs: | |
scan-clusters: | |
name: cluster-scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "scripts/cluster-scanner/go.mod" | |
- name: Install Dependencies | |
working-directory: scripts/cluster-scanner | |
run: go get ./... | |
- name: Execute Tests | |
working-directory: scripts/cluster-scanner | |
run: go test ./... | |
- name: Launch the Application and Capture Logs | |
working-directory: scripts/cluster-scanner | |
run: go run . | tee result.log | |
- name: Get Clusters with More Than 24 Hours and Format Output | |
working-directory: scripts/cluster-scanner | |
run: | | |
if grep -q "The following clusters have been running" result.log; then | |
echo "CLUSTERS_FOUND=true" >> $GITHUB_ENV | |
{ | |
echo 'LOG_MESSAGE<<EOF' | |
sed 's/^.*msg=//' result.log | sed -n '/The following clusters/,/$/p' | sed 's/"//g' | |
echo EOF | |
} >> "$GITHUB_ENV" | |
fi | |
- name: Send Slack Notification | |
if: env.CLUSTERS_FOUND == 'true' | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }} | |
SLACK_USERNAME: "spectromate" | |
SLACK_COLOR: "good" | |
SLACKIFY_MARKDOWN: true | |
ENABLE_ESCAPES: true | |
SLACK_MESSAGE: ${{ env.LOG_MESSAGE }} |