Skip to content

Commit 5e14c9c

Browse files
committed
eureka-server: don't create a new PR comment if it already exists
1 parent ab03048 commit 5e14c9c

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

.github/workflows/build_eureka_server.yaml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,30 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535

36-
- name: Build Image
37-
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
38-
shell: pwsh
39-
env:
40-
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
41-
42-
- name: Login to container registry
43-
uses: docker/login-action@v3
44-
with:
45-
registry: ${{ vars.DOCKER_REGISTRY }}
46-
username: ${{ secrets.DOCKER_USERNAME }}
47-
password: ${{ secrets.DOCKER_PASSWORD }}
48-
49-
- name: Push image
50-
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51-
52-
- uses: actions/github-script@v7
36+
# - name: Build Image
37+
# run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
38+
# shell: pwsh
39+
# env:
40+
# TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
41+
42+
# - name: Login to container registry
43+
# uses: docker/login-action@v3
44+
# with:
45+
# registry: ${{ vars.DOCKER_REGISTRY }}
46+
# username: ${{ secrets.DOCKER_USERNAME }}
47+
# password: ${{ secrets.DOCKER_PASSWORD }}
48+
49+
# - name: Push image
50+
# run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51+
52+
- name: Post PR comment with image info
5353
if: ${{ github.event_name == 'pull_request' }}
54-
with:
55-
script: |
56-
github.rest.issues.createComment({
57-
issue_number: context.issue.number,
58-
owner: context.repo.owner,
59-
repo: context.repo.repo,
60-
body: `To run the Eureka server image built for this pull request:
61-
\`\`\`bash
62-
docker run --rm -d --pull=always -p 8761:8761 --name eureka-pr steeltoe.azurecr.io/eureka-server:pr-${{ github.event.number }}
63-
\`\`\``
64-
})
54+
run: |
55+
gh pr comment $PR_NUMBER --edit-last --create-if-none --body "To run the Eureka Server image built for this pull request:
56+
\`\`\`bash
57+
docker run --rm -d --pull=always -p 8761:8761 --name eureka-pr steeltoe.azurecr.io/eureka-server:pr-$PR_NUMBER
58+
\`\`\`"
59+
shell: bash
60+
env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
PR_NUMBER: ${{ github.event.number }}

0 commit comments

Comments
 (0)