summaryrefslogtreecommitdiff
path: root/.github/workflows/release-edit-with-push.yml
blob: 944b98eb7cc20e91fea314124be3ebf6c5b9fc65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: "Release Manager: sync changelog with PR"

on:
  push:
    branches:
      - release/**
    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
      # headがrelease/かつopenのPRを1つ取得
      - name: Get PR
        run: |
          echo "pr_number=$(gh pr list --limit 1 --head "${{ github.ref_name }}" --json number  --jq '.[] | .number')" >> $GITHUB_OUTPUT
        id: get_pr
      - name: Get target version
        uses: misskey-dev/release-manager-actions/.github/actions/get-target-version@v1
        id: v
      # CHANGELOG.mdの内容を取得
      - name: Get changelog
        uses: misskey-dev/release-manager-actions/.github/actions/get-changelog@v1
        with:
          version: ${{ steps.v.outputs.target_version }}
        id: changelog
      # PRのnotesを更新
      - name: Update PR
        run: |
          gh pr edit ${{ steps.get_pr.outputs.pr_number }} --body "${{ steps.changelog.outputs.changelog }}"