61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
name: Check for formatting errors
|
|
run-name: Check for formatting errors on ${{ github.ref }}
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
format-check:
|
|
name: "Check for formatting errors"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "zulu"
|
|
java-version: "21"
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
cache: "pip"
|
|
- name: Run pre-commit
|
|
uses: pre-commit/action@v3.0.1
|
|
id: format-check
|
|
with:
|
|
extra_args: --all-files
|
|
|
|
- name: Match GitHub User to Slack User [MASTER]
|
|
if: >
|
|
always() && steps.format-check.outcome == 'failure' &&
|
|
github.ref == 'refs/heads/master' &&
|
|
github.event.pull_request.head.repo.fork == false
|
|
id: match-github-to-slack-user
|
|
uses: ./.github/actions/match-github-to-slack-user
|
|
env:
|
|
AIRBYTE_TEAM_BOT_SLACK_TOKEN: ${{ secrets.SLACK_AIRBYTE_TEAM_READ_USERS }}
|
|
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Format Failure on Master Slack Channel [MASTER]
|
|
if: >
|
|
always() && steps.format-check.outcome == 'failure' &&
|
|
github.ref == 'refs/heads/master' &&
|
|
github.event.pull_request.head.repo.fork == false
|
|
uses: abinoda/slack-action@master
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
|
|
with:
|
|
args: >-
|
|
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
|
|
{\"type\":\"divider\"},
|
|
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Formatting is broken on master! :bangbang: \n\n\"}},
|
|
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
|
|
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<@${{ steps.match-github-to-slack-user.outputs.slack_user_ids }}> \n\"}},
|
|
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-shocked: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-shocked: \n\"}},
|
|
{\"type\":\"divider\"}]}
|