metanorma/metanorma

View on GitHub
.github/workflows/notify.yml

Summary

Maintainability
Test Coverage
# Auto-generated by Cimas: Do not edit it manually!
# See https://github.com/metanorma/cimas
name: notify

on:
  repository_dispatch:
    types: [ notify ]

jobs:
  notify:
    name: Notify dependent repos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Trigger repositories
        env:
          GH_USERNAME: metanorma-ci
          GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
        run: |
          curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
          [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
          CLIENT_PAYLOAD=$(cat <<EOF
          "{ "ref": "${{ github.event.client_payload.ref }}", "repo": "${GITHUB_REPOSITORY}" }"
          EOF
          )
          for repo in $TEMPLATE_REPOS" $SAMPLES_REPOS"
          do
            sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
          done

      - name: Trigger release repositories
        if: github.event.client_payload.ref == 'refs/heads/master' || startsWith(github.event.client_payload.ref, 'refs/tags/v')
        env:
          GH_USERNAME: metanorma-ci
          GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
        run: |
          curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
          [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
          CLIENT_PAYLOAD=$(cat <<EOF
          "{ "ref": "${{ github.event.client_payload.ref }}", "repo": "${GITHUB_REPOSITORY}" }"
          EOF
          )
          for repo in $DEPENDENT_REPOS
          do
            sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
          done