name: Trigger cinny-mobile on: push: branches: - main jobs: dispatch: runs-on: ubuntu-latest if: ${{ !contains(github.event.head_commit.message || '', '[skip mobile]') }} steps: - name: Dispatch update-submodule on cinny-mobile env: # Prefer a PAT with write:repository on cinny-mobile (secret: ACTIONS_TOKEN). # Default GITHUB_TOKEN is usually scoped to this repo only. ACTIONS_TOKEN: ${{ secrets.ACTIONS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: ${{ github.server_url }}/api/v1 CINNY_SHA: ${{ github.sha }} run: | set -euo pipefail TOKEN="${ACTIONS_TOKEN:-${GITHUB_TOKEN:-}}" if [ -z "${TOKEN}" ]; then echo "No ACTIONS_TOKEN/GITHUB_TOKEN available to dispatch cinny-mobile" exit 1 fi BODY=$(jq -n \ --arg ref "master" \ --arg sha "${CINNY_SHA}" \ '{ref: $ref, inputs: {cinny_sha: $sha}}') echo "Dispatching litruv/cinny-mobile update-submodule.yml for ${CINNY_SHA}" HTTP_CODE=$(curl -sS -o /tmp/dispatch-body.txt -w "%{http_code}" \ -X POST \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/json" \ -d "${BODY}" \ "${API_BASE}/repos/litruv/cinny-mobile/actions/workflows/update-submodule.yml/dispatches?return_run_details=true") echo "HTTP ${HTTP_CODE}" cat /tmp/dispatch-body.txt || true echo case "${HTTP_CODE}" in 200|201|204) echo "Dispatch accepted" ;; *) echo "Dispatch failed" exit 1 ;; esac