123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- name: meta(labels)
- on:
- pull_request:
- paths:
- - .github/labels.yml
- push:
- branches:
- - master
- paths:
- - .github/labels.yml
- # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
- env:
- SEGMENT_DOWNLOAD_TIMEOUT_MIN: 3
- jobs:
- sync:
- name: syncs repository labels
- runs-on: ubuntu-latest
- permissions:
- issues: write
- pull-requests: write
- steps:
- - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- - uses: ./.github/actions/setup-volta
- - name: Install github-label-sync
- run: yarn global add github-label-sync@2.2.0
- - name: Run github-label-sync
- run: |
- github-label-sync \
- --access-token ${{ secrets.GITHUB_TOKEN }} \
- --labels .github/labels.yml \
- ${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
- ${{ github.repository }} \
- 2>&1 | tee sync-report.txt
- - name: Read sync output into variable
- uses: actions/github-script@deb7ae927cc19ae3a8b57293dd5cd2f16171e1e2 # v4
- if: github.event_name == 'pull_request'
- id: github-label-sync
- with:
- script: |
- const fs = require('fs');
- return fs.readFileSync('sync-report.txt','utf8').toString();
- result-encoding: string
- - name: Find previous dry-run comment
- uses: peter-evans/find-comment@1769778a0c5bd330272d749d12c036d65e70d39d
- if: github.event_name == 'pull_request'
- id: fc
- with:
- issue-number: ${{ github.event.pull_request.number }}
- comment-author: 'github-actions[bot]'
- body-includes: '<!-- LABELS_UPDATE -->'
- - name: Add or update dry-run comment
- uses: peter-evans/create-or-update-comment@b95e16d2859ad843a14218d1028da5b2c4cbc4b4
- if: github.event_name == 'pull_request'
- with:
- issue-number: ${{ github.event.pull_request.number }}
- comment-id: ${{ steps.fc.outputs.comment-id }}
- edit-mode: replace
- body: >
- <!-- LABELS_UPDATE -->
- π· The following changes will be made to the repository labels
- ```
- ${{ steps.github-label-sync.outputs.result }}
- ```
|