forked from workfloworchestrator/orchestrator-core-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.93 KB
/
scheduled-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Scheduled build and test
on:
schedule: # Targets the default branch
- cron: '0 6 * * MON' # This is UTC, no TZ option yet unfortunately
jobs:
check_week:
runs-on: ubuntu-latest
# Custom check as github does not support modulo syntax from gitlab ("0 7 * * MON%2")
outputs:
should_cancel: ${{ steps.week-modulo.outputs.should_cancel }}
steps:
- run: echo "::set-output name=should_cancel::$(expr `date +%W` % 2)"
id: week-modulo
- name: Cancel workflow every other week
uses: andymckay/cancel-action@0.2
if: ${{ steps.week-modulo.outputs.should_cancel == '1' }}
run_gpl:
uses: ./.github/workflows/test-standalone.yml
needs: [check_week]
run_surf:
uses: ./.github/workflows/test-surf.yml
needs: [run_gpl]
slack:
needs: [check_week, run_surf]
runs-on: ubuntu-latest
if: ${{ needs.check_week.outputs.should_cancel != '1' }}
steps:
- uses: technote-space/workflow-conclusion-action@v2
- run: echo "ICON=$([ \"$WORKFLOW_CONCLUSION\" == \"success\" ] && echo white_check_mark || echo zap)" >> $GITHUB_ENV
- run: echo "REPO=$(echo "$GITHUB_REPOSITORY" | cut -d '/' -f2-)" >> $GITHUB_ENV
- run: echo "MSG=$([ \"$WORKFLOW_CONCLUSION\" == \"success\" ] && echo "Successful build" || echo "Build failed")" >> $GITHUB_ENV
- run: echo "CI_JOB_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- run: wget --quiet https://raw.githubusercontent.com/workfloworchestrator/nitpick-style/main/ci/scripts/slack.sh && chmod +x slack.sh
- run: ./slack.sh "${{ secrets.CI_SLACK_NOTIFICATION_CHANNEL }}" "$MSG $REPO $CI_JOB_URL" $ICON "Github Pipeline"
if: ${{ contains(fromJson('["failure", "timed_out", "success"]'), env.WORKFLOW_CONCLUSION) }} # notify on success, failure, timeout
env:
CI_SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}