Skip to content

Commit ab03048

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

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ indent_size = 4
1010
trim_trailing_whitespace = true
1111
insert_final_newline = true
1212
charset = utf-8
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
tab-width = 2
17+
max_line_length = 160
18+
indent_size = 2

.github/workflows/build_config_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 Spring Cloud Config Server image built for this pull request:
61-
\`\`\`bash
62-
docker run --rm -d --pull=always -p 8888:8888 --name config-pr steeltoe.azurecr.io/config-server:pr-${{ github.event.number }}
63-
\`\`\``
64-
})
54+
run: |
55+
gh pr comment $PR_NUMBER --edit-last --create-if-none --body "To run the Spring Cloud Config Server image built for this pull request:
56+
\`\`\`bash
57+
docker run --rm -d --pull=always -p 8888:8888 --name config-pr $REGISTRY/$IMAGE_NAME: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)