-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (35 loc) · 1.3 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Open Pull Request
on:
pull_request:
types:
- opened
branches:
- develop
permissions:
id-token: write
contents: read
actions: read
pull-requests: write
jobs:
endpoint:
runs-on: ubuntu-latest
steps:
- name: set branch_name
run: echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: get endpoint
run: echo "application_endpoint_url="`aws cloudformation describe-stacks --stack-name ui-${{env.branch_name}} --output text --query "Stacks[0].Outputs[?OutputKey=='ApplicationEndpointUrl'].OutputValue"` >> $GITHUB_ENV
- name: Add endpoint in PR
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Endpoint URL - ${{env.application_endpoint_url || 'Environment not yet deployed, delete this comment and run the Pull Request workflow again after deploy is complete'}}"
})