forked from woocommerce/woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changelog.txt update workflow (woocommerce#34554)
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Run post release processes | ||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
GIT_COMMITTER_NAME: 'WooCommerce Bot' | ||
GIT_COMMITTER_EMAIL: 'no-reply@woocommerce.com' | ||
GIT_AUTHOR_NAME: 'WooCommerce Bot' | ||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com' | ||
|
||
jobs: | ||
update-changelog-in-trunk: | ||
name: Update changelog in trunk | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get tag name | ||
id: tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const tag = ${{ toJSON( github.event.release.tag_name ) }} | ||
console.log( `::set-output name=tag::release/${ tag.substring( 0, 3 ) }` ) | ||
- name: Git fetch trunk branch | ||
run: git fetch origin trunk | ||
|
||
- name: Copy changelog.txt to vm root | ||
run: cp changelog.txt ../../changelog.txt | ||
|
||
- name: Switch to trunk branch | ||
run: git checkout trunk | ||
|
||
- name: Create a new branch based on trunk | ||
run: git checkout -b update/changelog-from-release-${{ github.event.release.tag_name }} | ||
|
||
- name: Copy saved changelog.txt to monorepo | ||
run: cp ../../changelog.txt ./changelog.txt | ||
|
||
- name: Commit changes | ||
run: git commit -am "Update changelog.txt from release ${{ github.event.release.tag_name }}" | ||
|
||
- name: Push branch up | ||
run: git push origin update/changelog-from-release-${{ github.event.release.tag_name }} | ||
|
||
- name: Create the PR | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const body = "This PR updates the changelog.txt based on the latest release: ${{ github.event.release.tag_name }}" | ||
const pr = await github.rest.pulls.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: "Update changelog.txt from release ${{ github.event.release.tag_name }}", | ||
head: "update/changelog-from-release-${{ github.event.release.tag_name }}", | ||
base: "trunk", | ||
body: body | ||
}) | ||
const prCreated = await github.rest.pulls.requestReviewers({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pr.data.number, | ||
reviewers: ["${{ github.event.release.author.login }}"] | ||
}) |