Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

  • Understand the issue: Workflows create redundant comments on each run
  • Explore the repository structure and existing workflows
  • Review PR Adjust workflow comments #50 attempt and understand why it failed (race conditions with --edit-last)
  • Update all 4 workflow files to use comment markers for idempotent updates:
    • build_config_server.yaml
    • build_eureka_server.yaml
    • build_springboot_admin_server.yaml
    • build_uaa_server.yaml
  • Request code review and address feedback:
    • Add per_page: 100 to handle PRs with many comments
    • Check that comment is from github-actions[bot] user
  • Run security checks (no vulnerabilities found)
  • Fix build.gradle.patch for spring-boot-admin to match current file structure

Solution

Each workflow now:

  1. Uses a unique HTML comment marker (e.g., <!-- IMAGE_INSTRUCTIONS_CONFIG_SERVER -->)
  2. Searches existing comments (up to 100) for one that:
    • Is from the github-actions[bot] user
    • Starts with its unique marker
  3. If found, updates that comment; otherwise, creates a new one

This approach ensures:

  • Each workflow maintains exactly ONE comment per PR
  • Re-running a workflow updates the existing comment instead of creating a new one
  • Different workflows don't interfere with each other (no race conditions)
  • User comments won't be accidentally modified
Original prompt

This section details on the original issue you should resolve

<issue_title>Update workflows to only add a single comment for how to run an image</issue_title>
<issue_description>Currently each workflow in this project will add a comment on each workflow run, containing instructions on how to run the relevant image in a local container. This can result in many redundant "how to run this image" comments. See #48 for an example.

Ideally we'd have one single comment that is updated to contain the instructions for every image that's being built, but it would be an improvement if each workflow maintained a single comment instead of creating a new one every time.</issue_description>

<agent_instructions>There is a not-exactly-successful attempt at resolving this issue here #50</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@bart-vmware One way to accomplish this is by using the GitHub CLI, such as [here](https://github.com/SteeltoeOSS/Steeltoe/blob/main/.github/workflows/Steeltoe.All.yml#L145):
run: gh pr comment $PR_NUMBER --edit-last --create-if-none --body-file coveragereport/Summary.md
env:
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  PR_NUMBER: ${{ github.event.number }}
```</body></comment_new>
<comment_new><author>@TimHess</author><body>
> One way to accomplish this is by using the GitHub CLI, such as [here](https://github.com/SteeltoeOSS/Steeltoe/blob/main/.github/workflows/Steeltoe.All.yml#L145):
> 
> ```
> run: gh pr comment $PR_NUMBER --edit-last --create-if-none --body-file coveragereport/Summary.md
> env:
>   GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
>   PR_NUMBER: ${{ github.event.number }}
> ```

That seems like a simple solution, but there are up to 4 different workflows that might want to add a comment... quick experiment in SteeltoeOSS/Dockerfiles#50 shows the comments overwrite each other. We could probably do some scripting to evaluate the comment body and append to it, but I wonder how annoying that race condition would be.</body></comment_new>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 28, 2026 19:24
Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com>
Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com>
@github-actions
Copy link

To run the UAA server image built for this pull request:

docker run --rm -d --pull=always -p 8080:8080 --name uaa-pr steeltoe.azurecr.io/uaa-server:pr-54

@github-actions
Copy link

To run the Eureka server image built for this pull request:

docker run --rm -d --pull=always -p 8761:8761 --name eureka-pr steeltoe.azurecr.io/eureka-server:pr-54

@github-actions
Copy link

To run the Spring Cloud Config Server image built for this pull request:

docker run --rm -d --pull=always -p 8888:8888 --name config-pr steeltoe.azurecr.io/config-server:pr-54

Copilot AI changed the title [WIP] Update workflows to add a single comment for image instructions Update workflows to only add a single comment for how to run an image Jan 28, 2026
Copilot AI requested a review from TimHess January 28, 2026 19:27
@TimHess
Copy link
Member

TimHess commented Jan 28, 2026

@copilot the spring boot admin server workflow is failing because one of the patch files isn't matching.

Update spring-boot-admin/patches/build.gradle.patch to look like this:

--- ./build.gradle	2025-09-22 14:48:20.000000000 -0500
+++ ./build.gradle	2026-01-27 00:00:00.000000000 -0500
@@ -38,3 +38,10 @@
 tasks.named('test') {
        useJUnitPlatform()
 }
+
+bootBuildImage {
+    createdDate = "now"
+    environment = [
+       "BP_SPRING_CLOUD_BINDINGS_DISABLED": "true"
+    ]

Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot the spring boot admin server workflow is failing because one of the patch files isn't matching.

Update spring-boot-admin/patches/build.gradle.patch to look like this:
...

Updated spring-boot-admin/patches/build.gradle.patch with the provided content in commit 349eb18.

@github-actions
Copy link

To run the Spring Boot Admin server image built for this pull request:

docker run --rm -d --pull=always -p 9099:9099 --name sba-pr steeltoe.azurecr.io/spring-boot-admin:pr-54

@TimHess TimHess marked this pull request as ready for review January 28, 2026 21:11
Copilot AI review requested due to automatic review settings January 28, 2026 21:11
@TimHess TimHess requested a review from bart-vmware January 28, 2026 21:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves the issue of workflows creating redundant comments on each run by implementing an idempotent comment update mechanism. Instead of creating a new comment every time a workflow runs, each workflow now searches for its existing comment (using a unique HTML marker) and updates it if found, or creates it if not. This approach avoids the race condition issues encountered in PR #50 where --edit-last caused different workflows to overwrite each other's comments.

Changes:

  • Updated all four build workflow files to use unique HTML comment markers for idempotent comment updates
  • Modified the spring-boot-admin build.gradle patch to match the current file structure
  • Added pagination support (per_page: 100) and bot user filtering based on code review feedback

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/build_config_server.yaml Replaced simple comment creation with marker-based update-or-create logic using unique marker IMAGE_INSTRUCTIONS_CONFIG_SERVER
.github/workflows/build_eureka_server.yaml Replaced simple comment creation with marker-based update-or-create logic using unique marker IMAGE_INSTRUCTIONS_EUREKA_SERVER
.github/workflows/build_springboot_admin_server.yaml Replaced simple comment creation with marker-based update-or-create logic using unique marker IMAGE_INSTRUCTIONS_SPRING_BOOT_ADMIN
.github/workflows/build_uaa_server.yaml Replaced simple comment creation with marker-based update-or-create logic using unique marker IMAGE_INSTRUCTIONS_UAA_SERVER
spring-boot-admin/patches/build.gradle.patch Updated patch to remove version upgrade section and adjust line numbers to match current file structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@TimHess TimHess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bart-vmware bart-vmware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nice!

  • Comments stay at their original position
  • When a comment gets updated with the same contents, its last-modified time is retained at the original value (no "edited" entry)
  • After changing the comment myself, the next build restores it to the original value (with "edited" history, see picture below)
  • I don't get a new email when the content of an existing comment has changed
  • When I change the workflow to produce a different comment, it gets added to the history of the existing comment (picture below)
Image Image

@TimHess TimHess merged commit d624c00 into main Jan 29, 2026
11 checks passed
@TimHess TimHess deleted the copilot/update-workflows-single-comment branch January 29, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update workflows to only add a single comment for how to run an image

3 participants