Repository navigation
chore(gocd): use GitHub App credentials - #351
Merged
Merged
Conversation
kenzoengineer
approved these changes
Sep 3, 2026
joshuarli
marked this pull request as ready for review
September 3, 2026 23:20
| build-production: | ||
| runs-on: ubuntu-24.04 | ||
| if: github.ref_name == github.event.repository.default_branch | ||
| if: github.event_name == 'pull_request' || github.ref_name == github.event.repository.default_branch |
There was a problem hiding this comment.
Bug: The workflow change allows pull requests to trigger a job that may overwrite the production :latest Docker image, as there is no condition to prevent this.
Severity: CRITICAL
Suggested Fix
Add a condition to the image push steps to ensure they only execute on pushes to the default branch, not on pull request events. For example, change the step's condition to if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch. This will prevent PRs from overwriting the production image.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/image.yml#L12
Potential issue: The workflow condition was changed to `if: github.event_name ==
'pull_request' || github.ref_name == github.event.repository.default_branch`, allowing
the `build-production` job to run on pull requests. This job pushes to production Google
Artifact Registries and uses `tag_latest: true`. Because there is no explicit condition
to prevent pushes on pull request events, a build triggered by a PR could overwrite the
production `:latest` Docker image. This could result in an unvetted or unstable version
of the application being deployed to production.
joshuarli
enabled auto-merge (squash)
October 6, 2026 21:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace GoCD GitHub token references with GitHub App credentials.