{"id":28920272,"url":"https://github.com/wp-graphql/workflow-tests","last_synced_at":"2026-03-04T23:31:23.808Z","repository":{"id":282968320,"uuid":"950254501","full_name":"wp-graphql/workflow-tests","owner":"wp-graphql","description":"experimental repo used for testing some Github workflows","archived":false,"fork":false,"pushed_at":"2026-02-01T00:30:27.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-01T12:09:13.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-graphql.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-17T21:55:15.000Z","updated_at":"2025-03-18T21:20:52.000Z","dependencies_parsed_at":"2025-12-02T12:00:09.640Z","dependency_job_id":null,"html_url":"https://github.com/wp-graphql/workflow-tests","commit_stats":null,"previous_names":["wp-graphql/workflow-tests"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/wp-graphql/workflow-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-graphql%2Fworkflow-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-graphql%2Fworkflow-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-graphql%2Fworkflow-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-graphql%2Fworkflow-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-graphql","download_url":"https://codeload.github.com/wp-graphql/workflow-tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-graphql%2Fworkflow-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30099343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:31:22.529Z","status":"ssl_error","status_checked_at":"2026-03-04T23:31:22.112Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-22T04:13:13.737Z","updated_at":"2026-03-04T23:31:23.782Z","avatar_url":"https://github.com/wp-graphql.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automation Tests\n\nThis repository contains tests and examples for automating various aspects of WordPress plugin development, including:\n\n- Changeset generation\n- Version bumping\n- Changelog updates\n- Release management\n\n## Scripts\n\nThe repository includes several Node.js scripts for automating common tasks:\n\n- **generate-changeset.js**: Creates changeset files for tracking changes\n- **generate-release-notes.js**: Generates formatted release notes from changesets\n- **analyze-changesets.js**: Analyzes changesets to determine version bump type\n- **bump-version.js**: Updates version numbers in plugin files\n- **update-changelog.js**: Updates the CHANGELOG.md file with new entries\n- **update-readme.js**: Updates the readme.txt file with new entries\n- **update-changelogs.js**: Updates both changelog files at once\n- **update-upgrade-notice.js**: Updates the upgrade notice section in readme.txt\n- **build.js**: Builds the plugin for release\n\n## Detailed Script Documentation\n\n### generate-changeset.js\n\n**Purpose**: Creates a changeset file from PR information to track changes for the next release.\n\n**Usage**:\n```bash\nnode scripts/generate-changeset.js --pr=123 --title=\"feat: Add new feature\" --author=\"username\" --body=\"Description of the change\"\n# or using npm script\nnpm run changeset:generate -- --pr=123 --title=\"feat: Add new feature\" --author=\"username\" --body=\"Description of the change\"\n```\n\n**Required Parameters**:\n- `--pr`: PR number (integer)\n- `--title`: PR title (string)\n- `--author`: PR author username (string)\n\n**Optional Parameters**:\n- `--body`: PR description (string, default: empty string)\n- `--breaking`: Explicitly mark as breaking change (boolean, default: false)\n\n**Output**: Creates a markdown file in the `.changesets` directory with a filename based on the current timestamp and PR number (e.g., `20230101120000-pr-123.md`).\n\n**Breaking Change Detection**:\nThe script automatically detects breaking changes from:\n1. Conventional commit syntax with ! (e.g., \"feat!: Add breaking feature\")\n2. Title prefixed with \"BREAKING CHANGE:\" or containing \"BREAKING CHANGE:\"\n3. Description containing \"BREAKING CHANGE:\"\n4. Explicit `--breaking=true` flag\n\n**Example Output File**:\n```md\n---\ntitle: \"feat: Add new feature\"\npr: 123\nauthor: \"username\"\ntype: \"feat\"\nbreaking: false\ndescription: |\n  Description of the change\n---\n```\n\n### generate-release-notes.js\n\n**Purpose**: Generates formatted release notes from changesets for inclusion in GitHub releases and changelogs.\n\n**Usage**:\n```bash\nnode scripts/generate-release-notes.js [options]\n# or using npm script\nnpm run release:notes -- [options]\n```\n\n**Optional Parameters**:\n- `--format`: Output format (string, options: \"markdown\" or \"json\", default: \"markdown\")\n- `--repo-url`: Repository URL for PR links (string, default: extracted from package.json)\n- `--token`: GitHub token for API requests to identify contributor status (string)\n\n**Environment Variables**:\n- `REPO_URL`: Alternative to `--repo-url` parameter\n- `GITHUB_TOKEN`: Alternative to `--token` parameter\n\n**Output**: \n- In markdown format: Formatted release notes with categorized changes, PR links, and contributors\n- In JSON format: Structured data for programmatic use\n\n**Categorization**:\nChanges are categorized into:\n- Breaking changes (⚠️)\n- Features (✨)\n- Fixes (🐛)\n- Other changes (🔄)\n\n**Contributors Section**:\n- Lists all contributors who made changes\n- Identifies first-time contributors (3 or fewer commits) with a special indicator\n- Requires GitHub token to identify first-time contributors\n\n**Example Output (Markdown)**:\n```md\n## Release Notes\n\n### Breaking Changes ⚠️\n\n- **BREAKING CHANGE: Refactor API** ([#123](https://github.com/org/repo/pull/123)) - @username\n\n### Features ✨\n\n- **Add new feature** ([#124](https://github.com/org/repo/pull/124)) - @username\n\n### Fixes 🐛\n\n- **Fix bug in feature** ([#125](https://github.com/org/repo/pull/125)) - @username\n\n### Other Changes 🔄\n\n- **Update documentation** ([#126](https://github.com/org/repo/pull/126)) - @username\n\n## Contributors\n\nThanks to all the contributors who made this release possible!\n\n- @username\n- @first-time-contributor 🎉 (First-time contributor)\n```\n\n### analyze-changesets.js\n\n**Purpose**: Analyzes changesets to determine the appropriate version bump type (major, minor, patch) based on the changes.\n\n**Usage**:\n```bash\nnode scripts/analyze-changesets.js\n# or using npm script\nnpm run changeset:analyze\n```\n\n**Output**: \n- Logs the recommended version bump type to the console\n- Returns an exit code corresponding to the bump type (1 for major, 2 for minor, 3 for patch)\n\n**Determination Logic**:\n- Major bump: If any changeset has `breaking: true`\n- Minor bump: If any changeset has `type: \"feat\"` and no breaking changes\n- Patch bump: If no breaking changes or features (only fixes, docs, etc.)\n\n**Example Output**:\n```\nAnalyzing changesets...\nFound 5 changesets.\nBreaking changes: 1\nFeatures: 2\nOther changes: 2\nRecommended version bump: major\n```\n\n### bump-version.js\n\n**Purpose**: Updates version numbers in plugin files based on the current version and bump type.\n\n**Usage**:\n```bash\nnode scripts/bump-version.js [--type=\u003ctype\u003e]\n# or using npm script\nnpm run version:bump -- [--type=\u003ctype\u003e]\n```\n\n**Optional Parameters**:\n- `--type`: Force a specific bump type (string, options: \"major\", \"minor\", \"patch\", default: determined by analyzing changesets)\n\n**Files Updated**:\n- `constants.php`: Updates the version constant\n- `package.json`: Updates the version field\n- Main plugin file: Updates the version in the plugin header\n\n**Output**: \n- Logs the old and new versions to the console\n- Updates version numbers in the specified files\n\n**Example Output**:\n```\nCurrent version: 1.2.3\nBump type: minor\nNew version: 1.3.0\nUpdated version in constants.php\nUpdated version in package.json\nUpdated version in automation-tests.php\n```\n\n### update-changelog.js\n\n**Purpose**: Updates the CHANGELOG.md file with new entries from changesets.\n\n**Usage**:\n```bash\nnode scripts/update-changelog.js --version=\u003cversion\u003e\n# or using npm script\nnpm run changelog:update -- --version=\u003cversion\u003e\n```\n\n**Required Parameters**:\n- `--version`: The new version to add to the changelog (string)\n\n**Output**: \n- Updates CHANGELOG.md with new entries categorized by type\n- Adds links to pull requests\n- Includes contributor information\n\n**Example Output in CHANGELOG.md**:\n```md\n# Changelog\n\n## 2.0.0 (2023-01-15)\n\n### Breaking Changes\n\n- **Refactor API** ([#123](https://github.com/org/repo/pull/123)) - @username\n\n### Features\n\n- **Add new feature** ([#124](https://github.com/org/repo/pull/124)) - @username\n\n### Fixes\n\n- **Fix bug in feature** ([#125](https://github.com/org/repo/pull/125)) - @username\n\n### Other Changes\n\n- **Update documentation** ([#126](https://github.com/org/repo/pull/126)) - @username\n\n## 1.2.0 (2022-12-01)\n\n...\n```\n\n### update-readme.js\n\n**Purpose**: Updates the readme.txt file with new changelog entries in WordPress plugin repository format.\n\n**Usage**:\n```bash\nnode scripts/update-readme.js --version=\u003cversion\u003e\n# or using npm script\nnpm run readme:update -- --version=\u003cversion\u003e\n```\n\n**Required Parameters**:\n- `--version`: The new version to add to the changelog (string)\n\n**Output**: \n- Updates the Changelog section in readme.txt with new entries\n- Formats entries according to WordPress plugin repository standards\n\n**Example Output in readme.txt**:\n```\n== Changelog ==\n\n= 2.0.0 =\n* BREAKING CHANGE: Refactor API\n* Feature: Add new feature\n* Fix: Fix bug in feature\n* Other: Update documentation\n\n= 1.2.0 =\n...\n```\n\n### update-changelogs.js\n\n**Purpose**: Updates both CHANGELOG.md and readme.txt with new entries from changesets.\n\n**Usage**:\n```bash\nnode scripts/update-changelogs.js --version=\u003cversion\u003e\n# or using npm script\nnpm run changelogs:update -- --version=\u003cversion\u003e\n```\n\n**Required Parameters**:\n- `--version`: The new version to add to the changelogs (string)\n\n**Output**: \n- Calls update-changelog.js to update CHANGELOG.md\n- Calls update-readme.js to update readme.txt\n- Ensures both changelog files are in sync\n\n**Example Output**:\n```\nUpdating changelogs for version 2.0.0\nUpdated CHANGELOG.md\nUpdated readme.txt\n```\n\n### update-upgrade-notice.js\n\n**Purpose**: Updates the upgrade notice section in readme.txt with information about breaking changes.\n\n**Usage**:\n```bash\nnode scripts/update-upgrade-notice.js --version=\u003cversion\u003e --notes-file=\u003cpath\u003e\n# or using npm script\nnpm run upgrade-notice:update -- --version=\u003cversion\u003e --notes-file=\u003cpath\u003e\n```\n\n**Required Parameters**:\n- `--version`: The new version to add to the upgrade notice (string)\n- `--notes-file`: Path to the release notes file (string)\n\n**Output**: \n- Updates the Upgrade Notice section in readme.txt if breaking changes are found\n- No changes if no breaking changes are detected\n\n**Example Output in readme.txt**:\n```\n== Upgrade Notice ==\n\n= 2.0.0 =\nBREAKING CHANGE: This version includes API changes that are not backward compatible. Please review the changelog before upgrading.\n```\n\n### build.js\n\n**Purpose**: Builds the plugin for release, creating a zip file with all necessary files.\n\n**Usage**:\n```bash\nnode scripts/build.js [--version=\u003cversion\u003e]\n# or using npm script\nnpm run build -- [--version=\u003cversion\u003e]\n```\n\n**Optional Parameters**:\n- `--version`: The version to include in the zip filename (string, default: extracted from constants.php)\n\n**Output**: \n- Creates a zip file in the `build` directory (e.g., `automation-tests-2.0.0.zip`)\n- Includes only the necessary files for the plugin\n- Excludes development files like .git, node_modules, etc.\n\n**Example Output**:\n```\nBuilding plugin...\nExcluding development files...\nCreating zip file: build/automation-tests-2.0.0.zip\nBuild completed successfully!\n```\n\n## Breaking Change Detection\n\nBreaking changes are automatically detected from:\n\n1. Conventional commit syntax with ! (e.g., \"feat!: Add breaking feature\")\n2. Title prefixed with \"BREAKING CHANGE:\" or containing \"BREAKING CHANGE:\"\n3. Explicit `breaking: true` flag in changesets\n\nWhen breaking changes are detected, they are:\n- Highlighted in the release notes\n- Categorized separately in the changelog\n- Automatically added to the upgrade notice section in readme.txt to warn users\n\n## Changelog Formatting\n\nChangelogs are formatted according to WordPress plugin repository standards:\n\n- **readme.txt**: Uses the WordPress plugin repository format\n- **CHANGELOG.md**: Uses a more detailed Markdown format with:\n  - Categorized changes (breaking changes, features, fixes, other)\n  - Links to pull requests\n  - Contributors acknowledgment with special recognition for first-time contributors\n\n## Release Notes\n\nRelease notes are generated from changesets and include:\n\n- **Categorized Changes**: Breaking changes, features, fixes, and other changes\n- **Emoji Icons**: Visual indicators for different change types (⚠️ for breaking changes, ✨ for features, etc.)\n- **PR Links**: Full URLs to pull requests for easy reference\n- **Contributors Section**: Lists all contributors with special recognition for first-time contributors\n- **Automatic Formatting**: Unnecessary lines are removed for cleaner presentation\n\nRelease notes can be generated in both Markdown format (for GitHub releases) and JSON format (for programmatic use).\n\n## Release Management\n\nThis repository uses an automated release management system based on [changesets](https://github.com/changesets/changesets). The process works as follows:\n\n1. **Automatic Changeset Generation**: Changesets are automatically generated when PRs are merged to the develop branch.\n2. **Accumulating Changes**: Changesets accumulate in the develop branch until a release is ready.\n3. **Release PR**: A PR from develop to main is created, containing all the changesets.\n4. **Automated Release**: When the PR is merged, the release workflow:\n   - Bumps the version based on the changesets\n   - Updates changelogs\n   - Creates a GitHub release with release notes\n   - Deletes the processed changesets from main\n   - Syncs main back to develop to ensure both branches are in sync\n\n5. **Branch Synchronization**: After a release, the main branch is automatically merged back into develop:\n   - This ensures that version bumps and changelog updates are reflected in develop\n   - The merge uses a non-fast-forward strategy with a descriptive commit message\n   - The commit message includes [skip ci] to prevent triggering additional workflows\n   - This keeps both branches in sync and prevents divergence\n\nThis ensures a consistent and automated release process with proper versioning and documentation.\n\nFor more details on the release process, see [.github/workflows/release-management.md](.github/workflows/release-management.md).\n\n## Development Process\n\n1. Create a feature branch from `develop`\n2. Make changes and submit a PR to `develop`\n3. When the PR is merged, a changeset is automatically generated\n4. The changeset is committed to `develop`\n5. A release PR is created or updated from `develop` to `main`\n6. When ready for release, merge the release PR to `main`\n7. The release management workflow creates a tag and GitHub release\n8. The plugin is deployed to the appropriate environments\n\n## Local Testing\n\nYou can test the scripts locally:\n\n```bash\n# Generate a changeset\nnpm run changeset:generate -- --title=\"Add new feature\" --pr=123 --author=\"username\" --type=\"feat\"\n\n# Generate release notes\nnpm run release:notes\n\n# Generate release notes in JSON format\nnpm run release:notes -- --format=json\n\n# Generate release notes with a specific repository URL for PR links\nnpm run release:notes -- --repo-url=\"https://github.com/wp-graphql/automation-tests\"\n\n# Generate release notes with contributor recognition (requires GitHub token)\nnpm run release:notes -- --token=\"your_github_token\"\n\n# Using environment variables instead of command-line arguments\nexport REPO_URL=\"https://github.com/wp-graphql/automation-tests\"\nexport GITHUB_TOKEN=\"your_github_token\"\nnpm run release:notes\n\n# Analyze changesets\nnpm run changeset:analyze\n\n# Bump version\nnpm run version:bump -- --type=minor\n\n# Update changelogs\nnpm run changelogs:update\n\n# Update upgrade notice in readme.txt\nnpm run upgrade-notice:update -- --version=1.0.0 --notes-file=release_notes.md\n```\n\n## Environment Variables\n\nThe scripts support the following environment variables:\n\n- `REPO_URL`: Repository URL to use for PR links (used by `generate-release-notes.js`)\n  - This is used to generate full URLs to pull requests in release notes\n  - If not provided, the script will attempt to extract it from package.json\n  - Example: `https://github.com/wp-graphql/automation-tests`\n\n- `GITHUB_TOKEN`: GitHub token for API requests (used by `generate-release-notes.js` for contributor recognition)\n  - This is used to identify first-time contributors (3 or fewer commits)\n  - If not provided, the contributors section will still be included but without first-time contributor recognition\n  - You can create a personal access token in your GitHub account settings\n\nYou can set these variables in your environment or in a `.env` file to avoid passing them as command-line arguments each time.\n\n### Environment Variable Utilities\n\nThe repository includes a utility module for handling environment variables consistently across all scripts:\n\n```javascript\n// Import the utility\nconst { getEnvVar, getBoolEnvVar, getNumEnvVar } = require('./utils/env');\n\n// Get a string environment variable with a default value\nconst repoUrl = getEnvVar('REPO_URL', 'https://github.com/default/repo');\n\n// Get a boolean environment variable\nconst isDebug = getBoolEnvVar('DEBUG', false);\n\n// Get a numeric environment variable\nconst timeout = getNumEnvVar('TIMEOUT', 30000);\n```\n\nThis utility automatically:\n- Loads environment variables from `.env.local`, `.env.development`, or `.env` files (in that order of priority)\n- Works in both local development and CI/CD environments\n- Provides type conversion and default values\n- Only loads environment variables once per process\n\n## Directory Structure\n\n```\n.\n├── .github/\n│   └── workflows/\n│       ├── semantic-pr-titles.yml  # Validates PR titles\n│       ├── generate-changeset.yml  # Generates changesets\n│       ├── release-management.yml  # Prepares releases\n│       ├── create-tag.yml          # Creates tags\n│       ├── deploy.yml              # Deploys plugin\n│       └── README.md               # Workflow documentation\n├── .changesets/                    # Stores changesets\n├── scripts/                        # Node.js scripts\n│   ├── generate-changeset.js       # Generate changeset file\n│   ├── generate-release-notes.js   # Generate release notes from changesets\n│   ├── analyze-changesets.js       # Analyze changesets and determine bump type\n│   ├── bump-version.js             # Bump version numbers\n│   ├── update-changelog.js         # Update CHANGELOG.md\n│   ├── update-readme.js            # Update readme.txt\n│   ├── update-changelogs.js        # Update both changelog files at once\n│   ├── update-upgrade-notice.js    # Update upgrade notice section\n│   ├── build.js                    # Build plugin zip\n│   └── utils/                      # Utility modules\n│       └── env.js                  # Environment variable utilities\n├── automation-tests.php            # Main plugin file\n├── constants.php                   # Plugin constants\n├── CHANGELOG.md                    # Changelog\n└── readme.txt                      # WordPress.org readme\n```\n\n## Contributing\n\nThis is a test repository for workflow development. If you have suggestions for improvements, please open an issue or pull request.\n\n## License\n\nThis project is licensed under the GPL v2 or later.\n\n## Recent Improvements\n\nWe've made several significant improvements to the changeset generation workflow:\n\n### 1. Environment Variables Support\n- Added support for `REPO_URL` and `GITHUB_TOKEN` environment variables\n  - `REPO_URL` is used to generate proper links to pull requests in release notes\n  - `GITHUB_TOKEN` is used to identify contributor status via the GitHub API\n- Simplified configuration by setting values once in the environment\n  - Environment variables are set at the job level in GitHub Actions workflows\n  - This eliminates the need to pass them as command-line arguments to scripts\n- Reduced command-line complexity in the GitHub workflow\n\n### 2. Contributor Recognition\n- Added a contributors section to release notes\n- Special recognition for first-time contributors (3 or fewer commits)\n- Uses GitHub API to accurately identify contributor status\n\n### 3. Enhanced Release Notes\n- Better formatting with emoji icons for different change types\n- Full URLs for pull requests instead of just PR numbers\n- Automatic determination of bump type (major, minor, patch)\n- Categorization of changes into breaking changes, features, fixes, and other changes\n\n### 4. Improved Workflow\n- Cleaner GitHub workflow configuration\n- Better error handling and fallbacks\n- Direct file processing instead of relying on external scripts\n- Use of temporary files to keep the repository clean\n  - Release notes are generated in a temporary directory outside the repository (`/tmp/release-notes/`)\n  - This prevents Git from tracking these temporary files and avoids issues with `.gitignore`\n- Automatic PR creation and updating\n- Deletion of processed changesets to prevent duplicate changelog entries\n- Enhanced release notes formatting with unnecessary lines removed\n- Automatic addition of breaking changes to the upgrade notice section\n- Comprehensive documentation updates\n\nThese improvements make the changeset generation process more reliable, user-friendly, and informative, enhancing the overall development workflow. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-graphql%2Fworkflow-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-graphql%2Fworkflow-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-graphql%2Fworkflow-tests/lists"}