Repository navigation
74 lines (66 loc) · 3.13 KB
/
Copy pathlabeler.yml
File metadata and controls
74 lines (66 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
# SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
name: Labeler
# `pull_request_target` is disabled by ASF infra policy. This workflow runs from
# the default branch when `pull_request_signal.yml` starts, so it never runs the
# code of a pull request. See that file for details.
concurrency:
group: ${{ github.repository }}-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}-${{ github.workflow }}
cancel-in-progress: true
on:
workflow_run:
workflows: ["Pull request signal"]
types: [requested]
permissions: {}
jobs:
process:
name: Process
runs-on: ubuntu-slim
timeout-minutes: 10
if: github.event.workflow_run.event == 'pull_request'
# The token of a `workflow_run` workflow can update PRs from forks.
# Previously `pull_request_target` was used for the same reason, see
# https://github.com/apache/datafusion/issues/3743
permissions:
contents: read
pull-requests: write
steps:
# This checks out the default branch, never the pull request. The labeler
# config is checked out too, so the action reads it from the file.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: |
ci/scripts
.github/workflows/labeler
persist-credentials: false
# The same branch can target `main` and a release branch, so label every
# match. These are the current pull requests, so a delayed run for an
# older commit still labels the latest head.
- name: Find the pull requests
id: pr
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const pulls = await require('./ci/scripts/pull_requests_of_run.js')({ github, context });
if (pulls.length) core.setOutput('numbers', pulls.map((pull) => pull.number).join('\n'));
else core.info(`No open pull request for ${context.payload.workflow_run.head_sha}`);
- name: Assign GitHub labels
if: steps.pr.outputs.numbers != ''
uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.numbers }}
configuration-path: .github/workflows/labeler/labeler-config.yml
sync-labels: true
# TODO: Enable this when eps1lon/actions-label-merge-conflict is available.
# - name: Checks if PR needs rebase
# if: |
# github.event_name == 'push' ||
# (github.event_name == 'pull_request_target' &&
# (github.event.action == 'opened' ||
# github.event.action == 'synchronize'))
# uses: eps1lon/actions-label-merge-conflict@releases/2.x
# with:
# dirtyLabel: "needs-rebase"
# repoToken: "${{ secrets.GITHUB_TOKEN }}"