Extend the existing label synchronization system to handle P0 and P1 priority labels in addition to backport/* labels: - Add P0/P1 label syncing between issues and PRs bidirectionally - Automatically add 'force_on_cloud' label to PRs when P0/P1 labels are present (either copied from issues or added directly) The workflow now triggers on P0 and P1 label events in addition to backport/* labels, ensuring priority labels are properly reflected across the entire PR lifecycle. Refs: https://github.com/scylladb/scylla-pkg/issues/5383 Closes scylladb/scylladb#25604
50 lines
2.1 KiB
YAML
50 lines
2.1 KiB
YAML
name: Sync labels
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, labeled, unlabeled]
|
|
branches: [master, next]
|
|
issues:
|
|
types: [labeled, unlabeled]
|
|
|
|
jobs:
|
|
label-sync:
|
|
if: ${{ github.repository == 'scylladb/scylladb' }}
|
|
name: Synchronize labels between PR and the issue(s) fixed by it
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
.github/scripts/sync_labels.py
|
|
sparse-checkout-cone-mode: false
|
|
|
|
- name: Install dependencies
|
|
run: sudo apt-get install -y python3-github
|
|
|
|
- name: Pull request opened event
|
|
if: ${{ github.event.action == 'opened' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: python .github/scripts/sync_labels.py --repo ${{ github.repository }} --number ${{ github.event.number }} --action ${{ github.event.action }}
|
|
|
|
- name: Pull request labeled or unlabeled event
|
|
if: github.event_name == 'pull_request_target' && (startsWith(github.event.label.name, 'backport/') || github.event.label.name == 'P0' || github.event.label.name == 'P1')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: python .github/scripts/sync_labels.py --repo ${{ github.repository }} --number ${{ github.event.number }} --action ${{ github.event.action }} --label ${{ github.event.label.name }}
|
|
|
|
- name: Issue labeled or unlabeled event
|
|
if: github.event_name == 'issues' && (startsWith(github.event.label.name, 'backport/') || github.event.label.name == 'P0' || github.event.label.name == 'P1')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: python .github/scripts/sync_labels.py --repo ${{ github.repository }} --number ${{ github.event.issue.number }} --action ${{ github.event.action }} --is_issue --label ${{ github.event.label.name }}
|