From 59178b5aec2645af838b5e3ed104b0abf0850369 Mon Sep 17 00:00:00 2001 From: benpankow Date: Wed, 10 Jul 2024 12:49:14 -0700 Subject: [PATCH] test get prs --- actions/hybrid_branch_deploy/action.yml | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/actions/hybrid_branch_deploy/action.yml b/actions/hybrid_branch_deploy/action.yml index 18c4c95a..40f098d2 100644 --- a/actions/hybrid_branch_deploy/action.yml +++ b/actions/hybrid_branch_deploy/action.yml @@ -83,6 +83,34 @@ runs: env: DAGSTER_CLOUD_API_TOKEN: ${{ inputs.dagster_cloud_api_token }} + - name: Get git sha + id: get_shas + run: git rev-list --ancestry-path cd2a864d09faa69900bff468f0f78d7e630ff87b..${{ github.sha }} + + - uses: actions/github-script@v7 + id: get_prs + env: + # Input the output of the previous step + PREVIOUS_SHA: ${{ steps.get_shas.outputs.stdout }} + with: + script: | + const previousShas = process.env.PREVIOUS_SHA.split('\n').map(s => s.trim()).filter(s => s.length > 0); + let pullRequests = []; + for (const sha of previousShas) { + const pr = await github.rest.repos.listPullRequestsAssociatedWithCommit({ + commit_sha: sha, + owner: context.repo.owner, + repo: context.repo.repo, + }); + if (pr.data.length > 0) { + pullRequests.push(...pr.data); + } + } + reutrn pullRequests; + + - name: Print PRs + run: echo "${{ steps.get_prs.outputs.result }}" + # Optional steps, leaves PR comment about build status - name: Notify build success uses: ./action-repo/actions/utils/notify