chore(deps): update pnpm to v11.5.2 (#311) #46
This file contains hidden or 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
| name: trigger-sync-from-pr-comment | |
| on: | |
| issue_comment: | |
| types: [created] | |
| # consumer main 更新時に blog-contents の sync workflow を再走させ、 | |
| # 既存 sync PR (notion-sync-from-blog-contents branch) を最新 main base に rebase させる。 | |
| # 例: renovate PR merge / 人手 PR merge / sync PR merge → main が動く → 既存 sync PR が outdated | |
| push: | |
| branches: [main] | |
| jobs: | |
| comment-trigger: | |
| # comment-trigger は concurrency 無し (ユーザー操作で reaction 付与済の comment-trigger を | |
| # 後続 push で cancel すると 「eyes 付いたが dispatch されない」状態が発生するため) | |
| if: >- | |
| github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| github.event.comment.body == '/sync' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write # add reaction to comment | |
| steps: | |
| - name: Add reaction | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| github.rest.reactions.createForIssueComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: context.payload.comment.id, | |
| content: 'eyes', | |
| }); | |
| # blog-contents への repository_dispatch には GITHUB_TOKEN だと権限不足のため App token を発行 | |
| - name: Generate App token (for blog-contents dispatch) | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| app-id: ${{ secrets.WORKER_APP_ID }} | |
| private-key: ${{ secrets.WORKER_APP_PRIVATE_KEY }} | |
| owner: lacolaco | |
| repositories: blog-contents | |
| - name: Dispatch sync workflow in blog-contents | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| script: | | |
| await github.rest.repos.createDispatchEvent({ | |
| owner: 'lacolaco', | |
| repo: 'blog-contents', | |
| event_type: 'notion-sync-zenn', | |
| }); | |
| push-trigger: | |
| # 連打 / 複数 main push を debounce、blog-contents 側 sync workflow の concurrency と協調。 | |
| # comment-trigger には影響しないよう job レベルで設定 | |
| concurrency: | |
| group: dispatch-blog-contents-sync-push | |
| cancel-in-progress: true | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| # GITHUB_TOKEN は使わない (App token で dispatch) | |
| permissions: | |
| contents: read | |
| steps: | |
| # blog-contents への repository_dispatch には GITHUB_TOKEN だと権限不足のため App token を発行 | |
| - name: Generate App token (for blog-contents dispatch) | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| app-id: ${{ secrets.WORKER_APP_ID }} | |
| private-key: ${{ secrets.WORKER_APP_PRIVATE_KEY }} | |
| owner: lacolaco | |
| repositories: blog-contents | |
| - name: Dispatch sync workflow in blog-contents | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| script: | | |
| await github.rest.repos.createDispatchEvent({ | |
| owner: 'lacolaco', | |
| repo: 'blog-contents', | |
| event_type: 'notion-sync-zenn', | |
| }); |