|
6 | 6 | branches: |
7 | 7 | - main |
8 | 8 |
|
9 | | -permissions: |
10 | | - pull-requests: write |
11 | | - |
12 | 9 | jobs: |
13 | 10 | comment: |
14 | | - runs-on: ubuntu-latest |
15 | | - steps: |
16 | | - - uses: actions/github-script@v7 |
17 | | - with: |
18 | | - script: | |
19 | | - const num = context.issue.number; |
20 | | - const url = `https://omni-pr-${num}.homerun2-dev.sthings-vsphere.labul.sva.de`; |
21 | | - const marker = "<!-- preview-url-bot -->"; |
22 | | - const body = [ |
23 | | - marker, |
24 | | - "## 🚀 Preview environment", |
25 | | - "", |
26 | | - `| | |`, |
27 | | - `|--|--|`, |
28 | | - `| URL | ${url} |`, |
29 | | - `| Health | ${url}/health |`, |
30 | | - `| Namespace | \`homerun2-pr-${num}\` on \`homerun2-dev\` |`, |
31 | | - `| ArgoCD | [\`homerun2-pr-${num}\`](https://argocd.platform.sthings-vsphere.labul.sva.de/applications?search=homerun2-pr-${num}) |`, |
32 | | - "", |
33 | | - "Spinning up — give it a couple of minutes for image + kustomize OCI builds to publish and for ArgoCD to sync.", |
34 | | - "Closing this PR tears the preview down automatically.", |
35 | | - ].join("\n"); |
36 | | -
|
37 | | - // Sticky comment: update on reopen instead of stacking duplicates. |
38 | | - const { data: comments } = await github.rest.issues.listComments({ |
39 | | - owner: context.repo.owner, |
40 | | - repo: context.repo.repo, |
41 | | - issue_number: num, |
42 | | - }); |
43 | | - const existing = comments.find(c => c.body && c.body.includes(marker)); |
44 | | - if (existing) { |
45 | | - await github.rest.issues.updateComment({ |
46 | | - owner: context.repo.owner, |
47 | | - repo: context.repo.repo, |
48 | | - comment_id: existing.id, |
49 | | - body, |
50 | | - }); |
51 | | - } else { |
52 | | - await github.rest.issues.createComment({ |
53 | | - owner: context.repo.owner, |
54 | | - repo: context.repo.repo, |
55 | | - issue_number: num, |
56 | | - body, |
57 | | - }); |
58 | | - } |
| 11 | + uses: stuttgart-things/github-workflow-templates/.github/workflows/call-comment-preview-url.yaml@main |
| 12 | + with: |
| 13 | + hostname-prefix: omni-pr |
| 14 | + hostname-domain: homerun2-dev.sthings-vsphere.labul.sva.de |
| 15 | + namespace-prefix: homerun2-pr |
| 16 | + secrets: inherit # pragma: allowlist secret |
0 commit comments