Skip to content

Commit a0d5ca0

Browse files
authored
update PR desc with preview summary (#17212)
1 parent 8fe91c7 commit a0d5ca0

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.github/actions/deploy-gitpod/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ done
3939
previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 10m --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
4040
leeway run dev/preview:deploy-gitpod
4141
previewctl report >> "${GITHUB_STEP_SUMMARY}"
42+
43+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
44+
report=$(previewctl report | base64)
45+
{
46+
echo "report<<$EOF"
47+
echo "$report"
48+
echo "$EOF"
49+
} >> "$GITHUB_OUTPUT"

.github/pull_request_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## Description
22
<!-- Describe your changes in detail -->
33

4+
#### Preview status
5+
6+
gitpod:summary
7+
48
## Related Issue(s)
59
<!-- List the issue(s) this PR solves -->
610
Fixes #

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
with_integration_tests: ${{ steps.output.outputs.with_integration_tests }}
3939
latest_ide_version: ${{ contains( steps.pr-details.outputs.pr_body, '[x] latest-ide-version=true') }}
4040
leeway_cache_bucket: ${{ steps.output.outputs.leeway_cache_bucket }}
41+
pr_number: ${{ steps.pr-details.outputs.number }}
42+
pr_body: ${{ steps.pr-details.outputs.pr_body }}
4143
steps:
4244
- name: "Determine Branch"
4345
id: branches
@@ -344,6 +346,29 @@ jobs:
344346
with_dedicated_emulation: ${{needs.configuration.outputs.with_dedicated_emulation}}
345347
analytics: ${{needs.configuration.outputs.analytics}}
346348
workspace_feature_flags: ${{needs.configuration.outputs.workspace_feature_flags}}
349+
- uses: actions/github-script@v6
350+
if: needs.configuration.outputs.pr_number != '' && contains(needs.configuration.outputs.pr_body, 'gitpod:summary')
351+
with:
352+
script: |
353+
const prNumber = ${{ needs.configuration.outputs.pr_number }};
354+
355+
const summaryEncoded = `${{ steps.deploy-gitpod.outputs.report }}`;
356+
const summary = Buffer.from(summaryEncoded, 'base64').toString('utf8');
357+
358+
const { data: pr } = await github.rest.pulls.get({
359+
...context.repo,
360+
pull_number: prNumber,
361+
});
362+
363+
const prBody = pr.body;
364+
365+
const newBody = prBody.replace('gitpod:summary', summary);
366+
367+
await github.rest.pulls.update({
368+
...context.repo,
369+
pull_number: prNumber,
370+
body: newBody,
371+
});
347372
348373
monitoring:
349374
name: "Install Monitoring Satellite"

0 commit comments

Comments
 (0)