Skip to content

Commit a43692f

Browse files
authored
DX-2454 Add Open PR logic to listener (#64)
1 parent 66f63f7 commit a43692f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/listener.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,29 @@ jobs:
3333
config: ./openapi-config.yml
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
36+
37+
- name: Open Pull Request
38+
run: |
39+
exists=$(hub pr list -h {{ inputs.branch-name }})
40+
if [ -z "$exists" ]
41+
then
42+
hub pull-request --base Bandwidth:main -m '${{ github.event.client_payload.branchName }}' -m 'Generate SDK with Upstream API Spec Changes\n\nOpened By: ${{ github.event.client_payload.author }}'
43+
else
44+
echo "PR already exists for this branch"
45+
fi
46+
env:
47+
GITHUB_TOKEN: ${{ inputs.token }}
3648

49+
- name: Output PR Number
50+
id: output-pr-number
51+
run: echo "::set-output name=pr-number::$(hub pr list -h ${{ inputs.branch-name }} -f %I)"
52+
env:
53+
GITHUB_TOKEN: ${{ inputs.token }}
54+
3755
- uses: ./.github/actions/add_pr_comment
3856
with:
3957
username: ${{ secrets.DX_GITHUB_USERNAME }}
4058
token: ${{ secrets.DX_GITHUB_TOKEN }}
4159
repo-name: api-specs
4260
pr-number: ${{ github.event.client_payload.prNumber }}
43-
message: 'Python SDK Built'
61+
message: 'Python SDK built successfully\n\nSee the corresponding PR opened on the docsite SDK (no action required):\nhttps://github.com/Bandwidth/api-docs/pull/${{ steps.output-pr-number.outputs.pr-number }}''

0 commit comments

Comments
 (0)