Skip to content

Commit 4b6a826

Browse files
authored
use graphql api to get pr links (#41)
1 parent 114960f commit 4b6a826

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

.github/actions/deploy/action.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,29 @@ runs:
6868
env:
6969
GH_TOKEN: ${{ inputs.gh_token }}
7070
run: |
71-
prs=$(gh api \
72-
-H "Accept: application/vnd.github+json" \
73-
-H "X-GitHub-Api-Version: 2022-11-28" \
74-
/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls)
71+
data=$(gh api graphql \
72+
-F owner='${{ github.repository_owner }}' \
73+
-F name='${{ github.event.repository.name }}' \
74+
-F ref='${{ github.sha }}' \
75+
-F query='query($name: String!, $owner: String!, $ref: GitObjectID!) {
76+
repository(owner: $owner, name: $name) {
77+
object(oid: $ref) {
78+
...on Commit {
79+
associatedPullRequests(first: 10) {
80+
nodes {
81+
number
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}')
88+
89+
prs=$(echo $data | jq -r '.data.repository.object.associatedPullRequests.nodes[].number')
7590
7691
echo "prs=$prs" >> $GITHUB_OUTPUT
7792
echo "prs $prs"
93+
echo "data $data"
7894
7995
- name: Get ther run URL
8096
id: run
@@ -96,7 +112,7 @@ runs:
96112
[View the run](${{ steps.run.outputs.url }})
97113
EOF
98114
99-
for pr in $(echo '${{ steps.prs.outputs.prs }}' | jq -r '.[].number'); do
115+
for pr in $(echo '${{ steps.prs.outputs.prs }}'); do
100116
gh api \
101117
--method POST \
102118
-H "Accept: application/vnd.github.v3+json" \

.github/workflows/deploy.production.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ jobs:
3333
fly_token: ${{ secrets.FLY_TOKEN }}
3434
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
3535
gh_token: ${{ secrets.GITHUB_TOKEN }}
36-
37-
- uses: ./.github/actions/link

0 commit comments

Comments
 (0)