build-tools/.github/unused/trigger-cs-job.yml
Sahil Ahuja f280a99559 Update
2025-02-05 19:38:45 +05:30

50 lines
1.6 KiB
YAML

name: Manually trigger a cs repo workflow
on:
workflow_dispatch:
inputs:
image:
type: choice
description: Image to deploy
options:
- repo2.hub.gmetri.io/dt-api
- repo2.hub.gmetri.io/gmetrivr/dt-api
tag:
description: Tag to deploy
required: true
type: string
env:
DEPLOY_REPO: gmetrivr/cs-dt
jobs:
trigger-cs-job:
runs-on: ubuntu-22.04
permissions:
issues: write
steps:
- name: run workflow from cs repo
run: |
echo "Inputs:: image:${{ inputs.image }} tag: ${{ inputs.tag }}";
echo "github.api_url: ${{ github.api_url }}";
ISSUE_COMMENT_STRING=`echo "{ \"image\": \"${{ inputs.image }}\", \"tag\": \"${{ inputs.tag }}\" }" | jq tostring`
echo ISSUE_COMMENT_STRING: $ISSUE_COMMENT_STRING
API_JSON_BODY=`echo '{"body": '$ISSUE_COMMENT_STRING' }' | jq -r tostring`
echo API_JSON_BODY: $API_JSON_BODY
# {"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}
echo curl -X 'POST' \
'${{ github.api_url }}/repos/${{ env.DEPLOY_REPO }}/issues/1/comments' \
-H 'accept: application/json' \
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}' \
-H 'Content-Type: application/json' \
-d $API_JSON_BODY
curl -X 'POST' \
'${{ github.api_url }}/repos/${{ env.DEPLOY_REPO }}/issues/1/comments' \
-H 'accept: application/json' \
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}' \
-H 'Content-Type: application/json' \
-d $API_JSON_BODY