From ab030486cb9e7815f4bd041b10885588b83957f0 Mon Sep 17 00:00:00 2001 From: Tim Hess Date: Wed, 1 Oct 2025 10:59:46 -0500 Subject: [PATCH 1/2] config-server: don't create a new PR comment if it already exists --- .editorconfig | 6 +++ .github/workflows/build_config_server.yaml | 54 +++++++++++----------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.editorconfig b/.editorconfig index 045c22c..7607b68 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,9 @@ indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true charset = utf-8 + +[*.{yml,yaml}] +indent_size = 2 +tab-width = 2 +max_line_length = 160 +indent_size = 2 diff --git a/.github/workflows/build_config_server.yaml b/.github/workflows/build_config_server.yaml index 42ab0c9..86ebf42 100644 --- a/.github/workflows/build_config_server.yaml +++ b/.github/workflows/build_config_server.yaml @@ -33,32 +33,30 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build Image - run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}' - shell: pwsh - env: - TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }} - - - name: Login to container registry - uses: docker/login-action@v3 - with: - registry: ${{ vars.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Push image - run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - uses: actions/github-script@v7 + # - name: Build Image + # run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}' + # shell: pwsh + # env: + # TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }} + + # - name: Login to container registry + # uses: docker/login-action@v3 + # with: + # registry: ${{ vars.DOCKER_REGISTRY }} + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} + + # - name: Push image + # run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Post PR comment with image info if: ${{ github.event_name == 'pull_request' }} - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `To run the Spring Cloud Config Server image built for this pull request: - \`\`\`bash - docker run --rm -d --pull=always -p 8888:8888 --name config-pr steeltoe.azurecr.io/config-server:pr-${{ github.event.number }} - \`\`\`` - }) + run: | + gh pr comment $PR_NUMBER --edit-last --create-if-none --body "To run the Spring Cloud Config Server image built for this pull request: + \`\`\`bash + docker run --rm -d --pull=always -p 8888:8888 --name config-pr $REGISTRY/$IMAGE_NAME:pr-$PR_NUMBER + \`\`\`" + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }} From 5e14c9c41d861b9897b05294099650a728f23a6b Mon Sep 17 00:00:00 2001 From: Tim Hess Date: Wed, 1 Oct 2025 11:14:17 -0500 Subject: [PATCH 2/2] eureka-server: don't create a new PR comment if it already exists --- .github/workflows/build_eureka_server.yaml | 54 +++++++++++----------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_eureka_server.yaml b/.github/workflows/build_eureka_server.yaml index 9bd63fb..7bebc4c 100644 --- a/.github/workflows/build_eureka_server.yaml +++ b/.github/workflows/build_eureka_server.yaml @@ -33,32 +33,30 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build Image - run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}' - shell: pwsh - env: - TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }} - - - name: Login to container registry - uses: docker/login-action@v3 - with: - registry: ${{ vars.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Push image - run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - uses: actions/github-script@v7 + # - name: Build Image + # run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}' + # shell: pwsh + # env: + # TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }} + + # - name: Login to container registry + # uses: docker/login-action@v3 + # with: + # registry: ${{ vars.DOCKER_REGISTRY }} + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} + + # - name: Push image + # run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Post PR comment with image info if: ${{ github.event_name == 'pull_request' }} - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `To run the Eureka server image built for this pull request: - \`\`\`bash - docker run --rm -d --pull=always -p 8761:8761 --name eureka-pr steeltoe.azurecr.io/eureka-server:pr-${{ github.event.number }} - \`\`\`` - }) + run: | + gh pr comment $PR_NUMBER --edit-last --create-if-none --body "To run the Eureka Server image built for this pull request: + \`\`\`bash + docker run --rm -d --pull=always -p 8761:8761 --name eureka-pr steeltoe.azurecr.io/eureka-server:pr-$PR_NUMBER + \`\`\`" + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }}