Skip to content

Add GitHub Action for automatic framework version updates #1189

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 30, 2025

This PR implements a complete solution for automatically updating framework versions in response to release webhooks from Yii repositories, addressing issue #272.

Overview

The solution adds a GitHub Action that responds to repository_dispatch events and automatically updates the config/versions.php file when new Yii framework releases are published. This eliminates the need for manual version updates and works entirely within GitHub's infrastructure without requiring the website to be running.

Implementation Details

Core Workflow (.github/workflows/update-versions.yml)

  • Listens for repository_dispatch events with type yii-release
  • Validates incoming webhook payload data
  • Maps repositories to framework versions:
    • yiisoft/yii2 → Yii 2.0 versions
    • yiisoft/yii → Yii 1.1 versions
  • Updates config/versions.php while preserving exact formatting
  • Commits changes with detailed metadata

Update Engine (scripts/update-versions.php)

  • Robust PHP script that safely modifies the versions configuration
  • Adds new versions chronologically (newest releases first)
  • Prevents duplicate entries and maintains file structure
  • Provides clear error messages and validation

Helper Tools & Documentation

  • Manual trigger script (scripts/trigger-version-update.sh) for testing
  • Comprehensive test suite with unit and integration tests
  • Complete documentation (docs/automatic-version-updates.md) with setup instructions
  • Improved .gitignore to exclude backup files

Usage

Automatic Operation

Once configured, the workflow automatically triggers when Yii repositories publish new releases by sending a webhook to:

POST https://api.github.com/repos/yiisoft-contrib/yiiframework.com/dispatches

Manual Testing

Repository maintainers can manually trigger updates using the provided script:

GITHUB_TOKEN=your_token ./scripts/trigger-version-update.sh yii2 2.0.54

Safety Features

  • Idempotent design: Safe to run multiple times without creating duplicates
  • Comprehensive validation: All inputs are validated before processing
  • Error handling: Clear error messages for debugging
  • Format preservation: Maintains exact indentation and structure of original file
  • Rollback capability: Changes are committed individually for easy reversion

Example Update

When a new Yii 2.0.54 release is published, the workflow automatically adds:

'2.0' => [
    '2.0.54' => 'Aug 15, 2025',  // ← New entry added here
    '2.0.53' => 'Jun 27, 2025',
    // ... existing versions
],

This solution provides a robust, zero-maintenance approach to keeping framework version information current, directly addressing the automation needs outlined in issue #272.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • asset-packagist.org
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/xwSzNj /usr/bin/composer update --no-dev (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 30, 2025 07:08
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] @yiisoft-contrib/yiiframework.com/issues/272 solve it by adding a github action that reacts to webhook of another github repository and does the commit to config/versions. It should fully work at github without the website. Add GitHub Action for automatic framework version updates Jul 30, 2025
@Copilot Copilot AI requested a review from samdark July 30, 2025 07:12
Copilot finished work on behalf of samdark July 30, 2025 07:12
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