2024-03-03 19:54:13 -08:00
|
|
|
name: "Release Manager: sync changelog with PR"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-07-09 00:08:49 -07:00
|
|
|
- develop
|
2024-03-03 19:54:13 -08:00
|
|
|
paths:
|
|
|
|
- 'CHANGELOG.md'
|
|
|
|
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
issues: write
|
|
|
|
pull-requests: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
edit:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-07-09 00:08:49 -07:00
|
|
|
# headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得
|
2024-03-03 19:54:13 -08:00
|
|
|
- name: Get PR
|
|
|
|
run: |
|
2024-07-09 00:08:49 -07:00
|
|
|
echo "pr_number=$(gh pr list --limit 1 --search "head:$GITHUB_REF_NAME base:$STABLE_BRANCH is:open" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT
|
2024-03-03 19:54:13 -08:00
|
|
|
id: get_pr
|
2024-07-09 00:08:49 -07:00
|
|
|
env:
|
|
|
|
STABLE_BRANCH: ${{ vars.STABLE_BRANCH }}
|
2024-03-03 19:54:13 -08:00
|
|
|
- name: Get target version
|
2024-07-11 00:39:06 -07:00
|
|
|
if: steps.get_pr.outputs.pr_number != ''
|
2024-07-09 00:08:49 -07:00
|
|
|
uses: misskey-dev/release-manager-actions/.github/actions/get-target-version@v2
|
2024-03-03 19:54:13 -08:00
|
|
|
id: v
|
|
|
|
# CHANGELOG.mdの内容を取得
|
|
|
|
- name: Get changelog
|
2024-07-11 00:39:06 -07:00
|
|
|
if: steps.get_pr.outputs.pr_number != ''
|
2024-07-09 00:08:49 -07:00
|
|
|
uses: misskey-dev/release-manager-actions/.github/actions/get-changelog@v2
|
2024-03-03 19:54:13 -08:00
|
|
|
with:
|
|
|
|
version: ${{ steps.v.outputs.target_version }}
|
|
|
|
id: changelog
|
|
|
|
# PRのnotesを更新
|
|
|
|
- name: Update PR
|
2024-07-11 00:39:06 -07:00
|
|
|
if: steps.get_pr.outputs.pr_number != ''
|
2024-03-03 19:54:13 -08:00
|
|
|
run: |
|
2024-05-27 04:11:39 -07:00
|
|
|
gh pr edit "$PR_NUMBER" --body "$CHANGELOG"
|
|
|
|
env:
|
|
|
|
PR_NUMBER: ${{ steps.get_pr.outputs.pr_number }}
|
2024-07-09 00:08:49 -07:00
|
|
|
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
|