Skip to content

Commit

Permalink
return 2
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed Jul 10, 2024
1 parent 5e7846b commit 804636c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/hybrid_branch_deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
dagster_cloud_build_push:
runs-on: ubuntu-latest
needs: parse_workspace
permissions:
contents: read
pull-requests: read
name: Dagster Hybrid Branch Deployments
strategy:
fail-fast: false
Expand Down
61 changes: 31 additions & 30 deletions actions/hybrid_branch_deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@ runs:
ref: ${{ github.sha }}
fetch-depth: 100

- name: Get git sha
id: get_shas
run: git rev-list --ancestry-path cd2a864d09faa69900bff468f0f78d7e630ff87b..${{ github.event.pull_request.head.sha }}
shell: bash

- 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);
}
}
return pullRequests;
- name: Print PRs
run: echo "${{ steps.get_prs.outputs.result }}"
shell: bash


- name: Checkout action repo
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -84,36 +115,6 @@ 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.event.pull_request.head.sha }}
shell: bash

- 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);
}
}
return pullRequests;
- name: Print PRs
run: echo "${{ steps.get_prs.outputs.result }}"
shell: bash

# Optional steps, leaves PR comment about build status
- name: Notify build success
uses: ./action-repo/actions/utils/notify
Expand Down

0 comments on commit 804636c

Please sign in to comment.