Skip to content

Commit 6e89bbf

Browse files
yuxiqiankakao-stephen-c
authored andcommitted
[pipeline] Use GHA workflow triggers to run labeler workflow (apache#4274)
1 parent 40f27ba commit 6e89bbf

2 files changed

Lines changed: 51 additions & 11 deletions

File tree

.github/workflows/label.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,38 @@
1616
# This workflow will triage pull requests and apply a label based on the
1717
# paths that are modified in the pull request.
1818
#
19-
# To use this workflow, you will need to set up a .github/label.yml
19+
# To use this workflow, you will need to set up a .github/labeler.yml
2020
# file with configuration. For more information, see:
2121
# https://github.com/actions/labeler
2222

2323
name: Labeler
24+
2425
on:
25-
pull_request:
26-
branches:
27-
- master
28-
- release-*
26+
workflow_run:
27+
workflows: [Labeler-Trigger]
28+
types: [requested]
29+
30+
permissions:
31+
checks: write
32+
contents: read
33+
pull-requests: write
2934

3035
jobs:
3136
label:
32-
3337
runs-on: ubuntu-latest
34-
permissions:
35-
contents: read
36-
pull-requests: write
37-
3838
steps:
39+
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
40+
uses: actions/checkout@v6
41+
with:
42+
persist-credentials: false
43+
submodules: recursive
44+
- name: "Get information about the original trigger of the run"
45+
uses: ./.github/actions/get-workflow-origin
46+
id: source-run-info
47+
with:
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
sourceRunId: ${{ github.event.workflow_run.id }}
3950
- uses: actions/labeler@v6
4051
with:
41-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
52+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
53+
pr-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: Labeler-Trigger
17+
on:
18+
pull_request:
19+
branches:
20+
- master
21+
- release-*
22+
23+
jobs:
24+
label:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: "Do nothing. Just triggers corresponding workflow."
28+
run: echo

0 commit comments

Comments
 (0)