name: Notify

on:
  push:
    branches: [main]
    paths-ignore:
      - "doc/**"
      - ".github/**"
      - ".assets/**"
      - ".cargo/**"
      - "**.md"
      - "**.yml"
      - "LICENSE-**"
      - ".gitmessage"
      - ".pre-commit-config.yaml"

env:
  CARGO_TERM_COLOR: always

jobs:
  notify-change:
    runs-on: ubuntu-latest
    steps:
      - name: notify to ergscripts
        run: |
          TOKEN=${{ secrets.DEV_TOKEN }}

          curl \
            -X POST \
            -H "Authorization: token $TOKEN" \
            -H "Accept: application/vnd.github.v3+json" \
            https://api.github.com/repos/mtshiba/ergscripts/dispatches \
            -d '{"event_type":"notification-push-main","client_payload":{"msg": "a change has been pushed to main"}}'
