| 1 |
name: Sync Labels |
| 2 |
|
| 3 |
on: |
| 4 |
# NOTE: github.event is workflow_dispatch payload: |
| 5 |
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch |
| 6 |
workflow_dispatch: |
| 7 |
inputs: |
| 8 |
delete-unmapped: |
| 9 |
description: Delete labels not mapped in either global or local label configurations. |
| 10 |
default: false |
| 11 |
type: boolean |
| 12 |
|
| 13 |
dry-run: |
| 14 |
description: Run label synchronization workflow without making any changes. |
| 15 |
default: false |
| 16 |
type: boolean |
| 17 |
|
| 18 |
permissions: |
| 19 |
contents: read |
| 20 |
|
| 21 |
jobs: |
| 22 |
sync: |
| 23 |
if: '!github.event.repository.fork' |
| 24 |
runs-on: ubuntu-slim |
| 25 |
permissions: |
| 26 |
contents: read |
| 27 |
issues: write |
| 28 |
env: |
| 29 |
GLOBAL: https://raw.githubusercontent.com/conda/infra/main/.github/global.yml |
| 30 |
LOCAL: .github/labels.yml |
| 31 |
steps: |
| 32 |
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 33 |
with: |
| 34 |
persist-credentials: false |
| 35 |
|
| 36 |
- id: has_local |
| 37 |
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0 |
| 38 |
with: |
| 39 |
files: ${{ env.LOCAL }} |
| 40 |
|
| 41 |
- name: Global Only |
| 42 |
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3 |
| 43 |
if: steps.has_local.outputs.files_exists == 'false' |
| 44 |
with: |
| 45 |
config-file: ${{ env.GLOBAL }} |
| 46 |
delete-other-labels: ${{ inputs.delete-unmapped }} |
| 47 |
dry-run: ${{ inputs.dry-run }} |
| 48 |
|
| 49 |
- name: Global & Local |
| 50 |
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3 |
| 51 |
if: steps.has_local.outputs.files_exists == 'true' |
| 52 |
with: |
| 53 |
config-file: | |
| 54 |
${{ env.GLOBAL }} |
| 55 |
${{ env.LOCAL }} |
| 56 |
delete-other-labels: ${{ inputs.delete-unmapped }} |
| 57 |
dry-run: ${{ inputs.dry-run }} |