Files
cinny/.gitea/workflows/trigger-mobile.yml
litruv 17706ae019
Some checks failed
Trigger cinny-mobile / dispatch (push) Failing after 1s
Add workflow to dispatch cinny-mobile submodule bump on push.
2026-08-03 16:28:35 +10:00

54 lines
1.7 KiB
YAML

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 Actions write on cinny-mobile (secret name: GITEA_TOKEN).
# Default GITHUB_TOKEN is usually scoped to this repo only.
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_BASE: ${{ github.server_url }}/api/v1
CINNY_SHA: ${{ github.sha }}
run: |
set -euo pipefail
TOKEN="${GITEA_TOKEN:-${GITHUB_TOKEN:-}}"
if [ -z "${TOKEN}" ]; then
echo "No GITEA_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