Skip to content

Conversation

@danielmarv
Copy link
Member

âś… Summary

This pull request implements support for dynamically retrieving a CODE_OF_CONDUCT.md file directly from a specified GitHub repository. The system fetches, decodes, and serves the Code of Conduct at runtime using the GitHub REST API and integrates it into the CodeOfConductProvider interface.


📦 Key Features

  • Environment-based GitHub integration
    Easily toggle this feature via the guardian.integration.github.coc.enabled property.

  • Customizable repository source
    Configure the GitHub owner and repo through environment variables.

  • Branch fallback logic
    Searches for the CoC file across common branches (main, master, staging) and .github directory.

  • Secure GitHub token support
    Optional GitHub token support via guardian.integration.github.coc.token for private repositories or rate limit handling.

  • Filename pattern recognition
    Looks for multiple common variants of the CoC filename.

  • Pluggable CodeOfConductProvider
    Automatically overrides the default provider when the feature is enabled.


🛠️ New Files Added

  • GitHubClient.java – Interface for interacting with GitHub API.
  • GitHubClientImpl.java – REST-based implementation using RestTemplate.
  • GitHubCodeOfConductProvider.java – Main class that locates, fetches, and decodes the CoC file.
  • GitHubConfig.java – Spring configuration with conditional bean loading.

⚙️ Configuration (application.properties)

guardian.integration.github.coc.enabled=${GITHUB_COC_ENABLED:true}
guardian.integration.github.coc.owner=${GITHUB_COC_OWNER:OpenElements}
guardian.integration.github.coc.repo=${GITHUB_COC_REPO:Conduct-Guardian}
guardian.integration.github.coc.token=${GITHUB_COC_TOKEN}

@danielmarv danielmarv requested a review from hendrikebbers June 1, 2025 15:29
@danielmarv danielmarv self-assigned this Jun 1, 2025
hendrikebbers and others added 6 commits June 1, 2025 18:31
Signed-off-by: Daniel Ntege <[email protected]>
Signed-off-by: Daniel Ntege <[email protected]>
… and add GitHubClient implementation

Signed-off-by: Daniel Ntege <[email protected]>
…perations for violation reports

Signed-off-by: Daniel Ntege <[email protected]>
…d reporting functionalities; add AnalysisController, ConfigurationController, and ViolationReportController skeletons.

Signed-off-by: Daniel Ntege <[email protected]>
…gedResponse, TrendAnalysis, and ViolationReportDto

Signed-off-by: Daniel Ntege <[email protected]>
Copy link
Member

@hendrikebbers hendrikebbers left a comment

Choose a reason for hiding this comment

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

Let's remove the TrendDto and Endpoint. The rest is really great!

);
}

public TrendSummaryDto generateTrendSummary() {
Copy link
Member

Choose a reason for hiding this comment

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

I like the AnalysisDto and assume that the containing numbers can be helpful. The TrendSummaryDto currently looks not that useful to me. I believe the best is to remove it for now and only use the AnalysisDto until we have a clear idea about trend analysis

danielmarv added 10 commits July 4, 2025 23:34
…lysis, and ViolationReportDto; implement AnalysisController and ConfigurationController with endpoints for analysis and configuration retrieval, including validation logic.

Signed-off-by: Daniel Ntege <[email protected]>
…lation reports and statistics; update ViolationReportService to fix message retrieval; add repository and API configuration properties.

Signed-off-by: Daniel Ntege <[email protected]>
…nts as owner and Conduct-Guardian as repository

Signed-off-by: Daniel Ntege <[email protected]>
…alysisService for new metrics and trends; implement TrendSummaryDto; modify ViolationReport and ViolationReportService for record usage; enhance AnalysisController for trend retrieval.

Signed-off-by: Daniel Ntege <[email protected]>
…te ViolationReportController to handle missing severity parameter in report retrieval.

Signed-off-by: Daniel Ntege <[email protected]>
…oved pagination handling

Signed-off-by: Daniel Ntege <[email protected]>
… to ensure default values are set correctly

Signed-off-by: Daniel Ntege <[email protected]>
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.

2 participants