https://github.com/automattic/vip-build-tools
A collection of helpful build tools for WordPress VIP developers
https://github.com/automattic/vip-build-tools
vip
Last synced: 2 months ago
JSON representation
A collection of helpful build tools for WordPress VIP developers
- Host: GitHub
- URL: https://github.com/automattic/vip-build-tools
- Owner: Automattic
- License: gpl-3.0
- Created: 2021-05-06T11:45:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-30T14:53:58.000Z (over 1 year ago)
- Last Synced: 2024-11-30T13:54:20.673Z (10 months ago)
- Topics: vip
- Language: PHP
- Size: 78.1 KB
- Stars: 2
- Watchers: 9
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VIP Build Tools
A collection of helpful scripts to be used in CI jobs.
## Prerequisites
Make sure you have [composer](https://getcomposer.org/) installed.
## Install
To get setup run the following command in the `vip-build-scripts` directory:
```bash
composer install
```## Script: Changelog
Extracts changelog information from the last closed Pull Request description and sends a request to a WordPress posts endpoint.
### Options
| Option | Description | Required / Optional | Default Value |
|---------------------|:------------------------------------------------------------------------------------------------------------:|---------------------|-----------------------------|
| wp-endpoint | The WordPress posts endpoint the changelog will be posted at. | Required | |
| start-marker | The text marker used to find the start of the changelog description inside the PR description. | Optional | `Changelog Description` |
| end-marker | The text marker used to find the end of the changelog description inside the PR description. | Optional | `` |
| wp-status | The WordPress post status. | Optional | `draft` |
| wp-tag-ids | A comma separated list of WordPress tag ids to add to the post. | Optional | |
| link-to-pr | Whether or not to include the link to the PR in the post. | Optional | `true` |
| changelog-source | Source to create the changelog for. Use `last-release` to process release notes, otherwise processes last PR | Optional | |### Environment Variables
Most of these variables are already [built-in](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) by CircleCI.
| Option | Description | Required / Optional |
| ----------------------- |:--------------------------------------------------------------------:|---------------------|
| CIRCLE_PROJECT_USERNAME | The GitHub username of the current project. | Required |
| CIRCLE_PROJECT_REPONAME | The name of the repository of the current project. | Required |
| CHANGELOG_POST_TOKEN | WordPress.com auth token required to post to the endpoint. | Required |
| GITHUB_TOKEN | The GitHub personal acess token needed to read private repositories. | Optional |- `CHANGELOG_POST_TOKEN` can be generated using a helper app like https://github.com/Automattic/node-wpcom-oauth ([example instructions](https://wp.me/p6jPRI-4xy#comment-26288))
### Usage Example
```
GITHUB_TOKEN="" CHANGELOG_POST_TOKEN="" CIRCLE_PROJECT_USERNAME="" CIRCLE_PROJECT_REPONAME="" php scripts/github-changelog.php \
--wp-endpoint=https://example.com/wp-json/wp/v2/posts \
--wp-status=draft \
--wp-tag-ids=1 \
--wp-categories=3 \
--link-to-pr=true \
--changelog-source=last-release
```