|
| 1 | +name: 上流 API リリース監視 |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 11 * * *" # 毎日 JST 20:00 |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + issues: write |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + check: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - repo: mixigroup/mixi2-api |
| 20 | + name: mixi2-api |
| 21 | + description: "proto 定義・API 仕様" |
| 22 | + - repo: mixigroup/mixi2-application-sdk-go |
| 23 | + name: mixi2-application-sdk-go |
| 24 | + description: "公式 Go SDK" |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: 最新リリースを取得 |
| 28 | + id: release |
| 29 | + env: |
| 30 | + GH_TOKEN: ${{ github.token }} |
| 31 | + run: | |
| 32 | + if ! response=$(gh api "repos/${{ matrix.repo }}/releases/latest" 2>/dev/null); then |
| 33 | + echo "No release found for ${{ matrix.repo }}, skipping." |
| 34 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 35 | + exit 0 |
| 36 | + fi |
| 37 | + tag=$(echo "$response" | jq -r '.tag_name') |
| 38 | + url=$(echo "$response" | jq -r '.html_url') |
| 39 | + echo "tag=$tag" >> "$GITHUB_OUTPUT" |
| 40 | + echo "url=$url" >> "$GITHUB_OUTPUT" |
| 41 | + echo "skip=false" >> "$GITHUB_OUTPUT" |
| 42 | +
|
| 43 | + - name: 同一バージョンの Issue が存在するか確認 |
| 44 | + id: check |
| 45 | + if: steps.release.outputs.skip != 'true' |
| 46 | + env: |
| 47 | + GH_TOKEN: ${{ github.token }} |
| 48 | + run: | |
| 49 | + tag="${{ steps.release.outputs.tag }}" |
| 50 | + count=$(gh issue list \ |
| 51 | + --repo "${{ github.repository }}" \ |
| 52 | + --state all \ |
| 53 | + --limit 500 \ |
| 54 | + --json title \ |
| 55 | + --jq "[.[] | select(.title | (contains(\"${{ matrix.name }}\") and contains(\"${tag}\")))] | length") |
| 56 | + echo "count=$count" >> "$GITHUB_OUTPUT" |
| 57 | +
|
| 58 | + - name: upstream ラベルを作成(存在しない場合) |
| 59 | + if: steps.release.outputs.skip != 'true' && steps.check.outputs.count == '0' |
| 60 | + env: |
| 61 | + GH_TOKEN: ${{ github.token }} |
| 62 | + run: | |
| 63 | + gh label create "upstream" \ |
| 64 | + --color "0075ca" \ |
| 65 | + --description "上流リポジトリの変更への追従" \ |
| 66 | + --repo "${{ github.repository }}" \ |
| 67 | + --force |
| 68 | +
|
| 69 | + - name: Issue を作成 |
| 70 | + if: steps.release.outputs.skip != 'true' && steps.check.outputs.count == '0' |
| 71 | + env: |
| 72 | + GH_TOKEN: ${{ github.token }} |
| 73 | + run: | |
| 74 | + tag="${{ steps.release.outputs.tag }}" |
| 75 | + cat > /tmp/issue-body.md << ISSUEEOF |
| 76 | + ## 概要 |
| 77 | +
|
| 78 | + 上流リポジトリ [${{ matrix.repo }}](https://github.com/${{ matrix.repo }}) の新バージョン **${tag}** がリリースされました。 |
| 79 | + mixi2-js への追従が必要か確認・対応してください。 |
| 80 | +
|
| 81 | + ## リンク |
| 82 | +
|
| 83 | + - 🔖 [リリースノート](${{ steps.release.outputs.url }}) |
| 84 | + - 📂 [リポジトリ](https://github.com/${{ matrix.repo }}) |
| 85 | + - 🔍 [前バージョンとの差分](https://github.com/${{ matrix.repo }}/releases) |
| 86 | +
|
| 87 | + --- |
| 88 | +
|
| 89 | + ## 対応チェックリスト |
| 90 | +
|
| 91 | + ### 調査 |
| 92 | + - [ ] リリースノートを確認する |
| 93 | + - [ ] ${{ matrix.description }} の変更点を確認する(新規 RPC・型・フィールドの追加、既存の変更・廃止など) |
| 94 | +
|
| 95 | + ### 実装 |
| 96 | + - [ ] proto ファイルを更新する(変更があれば) |
| 97 | + - [ ] 新規 RPC を実装する(追加があれば) |
| 98 | + - [ ] 既存実装を修正する(変更・廃止があれば) |
| 99 | + - [ ] 型定義・Enum を追加・修正する |
| 100 | + - [ ] テストを追加・更新する |
| 101 | +
|
| 102 | + ### リリース |
| 103 | + - [ ] ドキュメント(pages/)を更新する |
| 104 | + - [ ] CHANGELOG.md を更新する |
| 105 | + - [ ] バージョンを更新して npm / JSR に公開する |
| 106 | +
|
| 107 | + --- |
| 108 | +
|
| 109 | + > このIssueは[上流APIリリース監視ワークフロー](https://github.com/${{ github.repository }}/actions/workflows/check-upstream.yml)によって自動作成されました。 |
| 110 | + ISSUEEOF |
| 111 | +
|
| 112 | + gh issue create \ |
| 113 | + --repo "${{ github.repository }}" \ |
| 114 | + --title "⬆️ ${{ matrix.name }} ${tag} がリリースされました" \ |
| 115 | + --label "upstream" \ |
| 116 | + --label "enhancement" \ |
| 117 | + --body-file /tmp/issue-body.md |
0 commit comments