feat: enhance GitHub PR resource with automatic build URLs - #15
Merged
Conversation
Add comprehensive enhancements to improve integration with Concourse CI:
1. Automatic Build URL Generation:
- UpdateCommitStatus now auto-generates Concourse build URL when target_url is empty
- Constructs URL from ATC_EXTERNAL_URL and BUILD_ID environment variables
- Enables clickable GitHub status checks linking back to pipeline builds
2. Environment Variable Expansion:
- Add safeExpandEnv() function for secure environment variable expansion
- Supports Concourse build metadata variables:
BUILD_ID, BUILD_NAME, BUILD_JOB_NAME, BUILD_PIPELINE_NAME,
BUILD_TEAM_NAME, ATC_EXTERNAL_URL
- Applied to target_url, context, and comment fields for dynamic values
3. Enhanced Configuration Parameters:
- Add base_context support for customizable status check context prefix
- Add description_file support for reading status description from file
- Fix delete_previous_comments type from string to boolean
4. Comment Management:
- Implement DeletePreviousComments() using GitHub GraphQL + REST API
- Queries user's previous comments via V4 API
- Deletes matching comments via V3 API to keep PR conversations clean
Changes:
- models/github.go: Auto URL generation, DeletePreviousComments()
- pr/out.go: safeExpandEnv(), enhanced parameter handling
- pr/models.go: Updated OutParams with new fields
- pr/helpers_test.go: Fixed test for boolean delete_previous_comments
All 51 tests passing with improved coverage.
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.
Add comprehensive enhancements to improve integration with Concourse CI:
Automatic Build URL Generation:
Environment Variable Expansion:
Enhanced Configuration Parameters:
Comment Management:
Changes:
All 51 tests passing with improved coverage.