diff --git a/.github/actions/repo-dispatch/action.yml b/.github/actions/repo-dispatch/action.yml index 91809e304a..797193d997 100644 --- a/.github/actions/repo-dispatch/action.yml +++ b/.github/actions/repo-dispatch/action.yml @@ -12,6 +12,9 @@ inputs: event-type: description: 'A custom event type for repository Dispatch' required: true + clientPayload: + description: 'Payload to send with the dispatch event' + required: false runs: using: 'node12' diff --git a/.github/actions/repo-dispatch/index.js b/.github/actions/repo-dispatch/index.js index ed96b0d4ea..099ad3d877 100644 --- a/.github/actions/repo-dispatch/index.js +++ b/.github/actions/repo-dispatch/index.js @@ -3,12 +3,13 @@ const core = require('@actions/core'); const github = require('@actions/github'); // The main function that wraps the action logic -async function run() { +async function run() {//change function name try { // Get inputs defined in action.yml using the core library const token = core.getInput('repo-token', { required: true }); const targetRepo = core.getInput('target-repository', { required: true }); const eventType = core.getInput('event-type', { required: true }); + const clientPayload = core.getInput('clientPayload') // Split the target repository string into owner and repository name const [owner, repo] = targetRepo.split('/'); @@ -21,7 +22,7 @@ async function run() { repo, // Repository name event_type: eventType, // Custom event type to trigger the workflow // Additional data to send with the event (optional) - client_payload: { ref: github.context.ref, sha: github.context.sha }, + client_payload: JSON.parse(clientPayload || {}), }); // Log a success message to the console @@ -33,4 +34,7 @@ async function run() { } // Execute the run function -run(); \ No newline at end of file +run(); + +//make my own workflow +// \ No newline at end of file diff --git a/.github/workflows/cross-repo-deploy.yml b/.github/workflows/cross-repo-deploy.yml new file mode 100644 index 0000000000..738c44f978 --- /dev/null +++ b/.github/workflows/cross-repo-deploy.yml @@ -0,0 +1,19 @@ +name: Trigger Deployment Workflow in CareObra + +on: + pull_request: + types: [closed] #doublechec this meaning + branches: + - feature/LADO-1108-GenerateAutomaticChange + +jobs: + trigger-deployment: + runs-on: ubuntu-latest + if: github.event.pull_request == true + steps: + - name: Trigger deployment in another repo + uses: ./.github/actions/repo-dispatch + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: UKHSA-Internal/hpod-ukhsa-generate-webform-url-citizen # Replace target repository's name + event-type: trigger-deployment # This is a custom event type we listen for in deployment.yml