Router testing #113
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
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
# | |
# OpenCRVS is also distributed under the terms of the Civil Registration | |
# & Healthcare Disclaimer located at http://opencrvs.org/license. | |
# | |
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | |
name: Listen for labels added to PRs | |
on: | |
pull_request: | |
types: [labeled] | |
jobs: | |
dispatch-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if added label is "🚀 Ready to deploy" | |
id: label_check | |
run: | | |
added_label=$(jq -r '.label.name' "$GITHUB_EVENT_PATH") | |
if [[ "$added_label" != "🚀 Ready to deploy" ]]; then | |
echo "Label not found or incorrect, skipping dispatch." | |
exit 1 | |
fi | |
echo "Correct label added, dispatching deploy workflow." | |
- name: Trigger Deploy Workflow | |
if: steps.label_check.outcome == 'success' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const prNumber = context.payload.pull_request.number; | |
const result = await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'deploy-to-feature-environment.yml', | |
ref: context.payload.pull_request.head.ref, | |
inputs: { | |
pr_number: prNumber.toString(), | |
} | |
}); | |
console.log(result); |