Pre-commit #11646
This file contains hidden or 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: Pre-commit | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "0 15 * * *" # 8AM Pacific; daily | |
| jobs: | |
| precommit: | |
| uses: ./.github/workflows/reusable-precommit.yml | |
| with: | |
| batfish_repo: "batfish/batfish" | |
| batfish_ref: "master" | |
| secrets: | |
| PYBATFISH_CODECOV_TOKEN: ${{ secrets.PYBATFISH_CODECOV_TOKEN }} | |
| notify-slack-on-failure: | |
| needs: precommit | |
| if: ${{ failure() && (github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/master')) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Slack notification on failure | |
| uses: slackapi/slack-github-action@v2.1.1 | |
| with: | |
| webhook: ${{ secrets.PYBATFISH_BUILD_FAILURE_SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "text": "*Pybatfish precommit workflow failed*", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*Pybatfish precommit workflow failed*" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "The precommit workflow has failed on the master branch.\n*Trigger:* ${{ github.event_name == 'schedule' && 'Scheduled run' || 'Push to master' }}\n*Repository:* ${{ github.repository }}\n*Commit:* ${{ github.sha }}" | |
| } | |
| }, | |
| { | |
| "type": "actions", | |
| "elements": [ | |
| { | |
| "type": "button", | |
| "text": { | |
| "type": "plain_text", | |
| "text": "View Workflow Run in GitHub Actions" | |
| }, | |
| "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| } | |
| ] | |
| } | |
| ] | |
| } |