build #2
This file contains 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: Build | |
on: | |
repository_dispatch: | |
types: [build] | |
env: | |
ALLOWED_REPOS: '["frontend-react", "frontend-next", "cover-router", "dummy-app"]' | |
ALLOWED_BRANCHES: '["dev", "master"]' | |
TARGET_REPO: ${{ github.event.client_payload.repo || 'none' }} | |
TARGET_BRANCH: ${{ github.event.client_payload.branch || 'none' }} | |
jobs: | |
check-calling-repo: | |
runs-on: ubuntu-22.04 | |
environment: production | |
timeout-minutes: 5 | |
steps: | |
- name: print-gh | |
run: echo gh '${{ toJSON(github) }}' | |
- name: print-env | |
run: echo env '${{ toJSON(env) }}' | |
- name: print-vars | |
run: echo vars '${{ toJSON(vars) }}' | |
- name: print-secrets | |
run: echo secrets '${{ toJSON(secrets) }}' | |
- name: check repos | |
if: ${{ ! contains(fromJSON(env.ALLOWED_REPOS), env.TARGET_REPO) }} | |
run: exit 2 # making it fail if the repo is not allowed | |
- name: check branch | |
if: ${{ ! contains(fromJSON(env.ALLOWED_BRANCHES), env.TARGET_BRANCH) }} | |
run: exit 1 # making it fail if the branch is not allowed |