From c7a746d48393eaebdff679ca401392294ab39379 Mon Sep 17 00:00:00 2001 From: Ashley Canning Date: Fri, 6 Sep 2024 20:29:58 +0100 Subject: [PATCH] Create trigger_clean_build.yml Signed-off-by: Ashley Canning --- .github/workflows/trigger_clean_build.yml | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/trigger_clean_build.yml diff --git a/.github/workflows/trigger_clean_build.yml b/.github/workflows/trigger_clean_build.yml new file mode 100644 index 0000000000..282d3b89cb --- /dev/null +++ b/.github/workflows/trigger_clean_build.yml @@ -0,0 +1,39 @@ +name: Trigger Clean Build + +on: + workflow_dispatch: + inputs: + pr_number: + description: 'Pull Request number to build' + required: true + type: number + +jobs: + trigger_clean_build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get PR branch + id: get_branch + run: | + PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr_number }}") + PR_BRANCH=$(echo $PR_DATA | jq -r .head.ref) + echo "pr_branch=${PR_branch}" >> $GITHUB_OUTPUT + + - name: Trigger Unity Cloud Build workflow + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'unity_cloud_build.yml', + ref: '${{ steps.get_branch.outputs.pr_branch }}', + inputs: { + clean_build: 'true' + } + })