Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This workflow reads its configuration from the .github/labeler.yml file.
name: pull-request-labeler
# This workflow applies labels for PRs targeted at feature branches.

name: label-pull-requests

on:
- pull_request_target
workflow_call:
# allow running the workflow manually from GitHub UI
workflow_dispatch:

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
strategy:
matrix:
include:
# branch -> label rules
- branch: HDDS-14496-zdu
label: zdu
fail-fast: false
steps:
- uses: actions/labeler@v5

- name: "Checkout project" # required for `gh` CLI
uses: actions/checkout@v4
with:
persist-credentials: false
sparse-checkout: |
.github
- name: "Add label ${{ matrix.label }} to PRs for ${{ matrix.branch }}"
run: |
gh pr list --base "$BRANCH" --search "-label:$LABEL" --json number --jq '.[].number' \
| xargs --max-args 1 --no-run-if-empty gh pr edit --add-label "$LABEL"
env:
# use variables to sanitize input
BRANCH: ${{ matrix.branch }}
LABEL: ${{ matrix.label }}
GH_TOKEN: ${{ github.token }}
15 changes: 11 additions & 4 deletions .github/labeler.yml → .github/workflows/schedule-label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Configuration for .github/workflows/label-pr.yml
# This workflow periodically applies labels for PRs.

# This rule can be deleted once the zero downtime upgrade feature branch is merged.
zdu:
- base-branch: HDDS-14496-zdu
name: scheduled-label-pull-requests

on:
# every 5 minutes
schedule:
- cron: '*/5 * * * *'

jobs:
label:
uses: ./.github/workflows/label-pr.yml
secrets: inherit