Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test get prs #185

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
37 changes: 37 additions & 0 deletions actions/hybrid_branch_deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,43 @@ runs:
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
fetch-depth: 500

- name: Get git sha
id: get_shas
run: |
echo "SHAS<<EOF" >> $GITHUB_OUTPUT
git rev-list --ancestry-path cd2a864d09faa69900bff468f0f78d7e630ff87b..${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/github-script@v7
id: get_prs
env:
# Input the output of the previous step
PREVIOUS_SHAS: ${{ steps.get_shas.outputs.SHAS }}
with:
script: |
const previousShas = process.env.PREVIOUS_SHAS.split('\n').map(s => s.trim()).filter(s => s.length > 0);
console.log(previousShas);
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.map(p => p.number));
}
}
console.log(pullRequests);
return pullRequests;

- name: Print PRs
run: echo "${{ steps.get_prs.outputs.result }}"
shell: bash


- name: Checkout action repo
uses: actions/checkout@v3
Expand Down
Loading