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

Use GH script action to set PR status #365

Merged
merged 1 commit into from
Apr 25, 2024
Merged
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
76 changes: 44 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,18 @@ jobs:
--overwrite

- name: Demo App URL
uses: octokit/[email protected]
uses: actions/github-script@v7
with:
route: POST /repos/{owner}/{repo}/statuses/${{ github.event.pull_request.head.sha || github.sha }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
state: success
target_url: https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.DEMO_APP_NAME }}/?appver=0.0.0
description: 'Passed'
context: 'Demo App URL on ${{ matrix.deployName }}'
script: |
await github.rest.repos.createCommitStatus({
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
sha: '${{github.event.pull_request.head.sha || github.sha}}',
context: 'Demo App URL on ${{ matrix.deployName }}',
state: 'success',
description: 'Passed',
target_url: `https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.DEMO_APP_NAME }}/?appver=0.0.0`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -387,15 +390,18 @@ jobs:
--overwrite

- name: Demo App URL - Root App
uses: octokit/[email protected]
uses: actions/github-script@v7
with:
route: POST /repos/{owner}/{repo}/statuses/${{ github.event.pull_request.head.sha || github.sha }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
context: 'Demo App (Root App) URL on ${{ matrix.deployName }}'
description: 'Passed'
state: success
target_url: https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/?appver=${{ env.PACKAGE_VERSION }}
script: |
await github.rest.repos.createCommitStatus({
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
sha: '${{github.event.pull_request.head.sha || github.sha}}',
context: 'Demo App (Root App) URL on ${{ matrix.deployName }}',
state: 'success',
description: 'Passed',
target_url: `https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/?appver=${{ env.PACKAGE_VERSION }}`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -423,15 +429,18 @@ jobs:
--overwrite

- name: Nextjs Demo App URL
uses: octokit/[email protected]
uses: actions/github-script@v7
with:
route: POST /repos/{owner}/{repo}/statuses/${{ github.event.pull_request.head.sha || github.sha }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
context: 'Nextjs Demo App URL on ${{ matrix.deployName }}'
description: 'Passed'
state: success
target_url: https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.NEXTJS_DEMO_APP_NAME }}?appver=${{ needs.build.outputs.nextjsDemoAppPackageVersion }}
script: |
await github.rest.repos.createCommitStatus({
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
sha: '${{github.event.pull_request.head.sha || github.sha}}',
context: 'Nextjs Demo App URL on ${{ matrix.deployName }}',
state: 'success',
description: 'Passed',
target_url: `https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.NEXTJS_DEMO_APP_NAME }}?appver=${{ needs.build.outputs.nextjsDemoAppPackageVersion }}`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -458,15 +467,18 @@ jobs:
--overwrite

- name: Release App URL
uses: octokit/[email protected]
uses: actions/github-script@v7
with:
route: POST /repos/{owner}/{repo}/statuses/${{ github.event.pull_request.head.sha || github.sha }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
context: 'Release App URL on ${{ matrix.deployName }}'
description: 'Passed'
state: success
target_url: https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.RELEASE_APP_NAME }}?appver=${{ needs.build.outputs.releaseAppPackageVersion }}
script: |
await github.rest.repos.createCommitStatus({
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
sha: '${{github.event.pull_request.head.sha || github.sha}}',
context: 'Release App URL on ${{ matrix.deployName }}',
state: 'success',
description: 'Passed',
target_url: `https://${{ steps.getCDKExports.outputs.edgeDomain }}${{ steps.getCDKExports.outputs.prefix }}/${{ env.RELEASE_APP_NAME }}?appver=${{ needs.build.outputs.releaseAppPackageVersion }}`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
Loading