Skip to content

Commit

Permalink
Fix labeler workflow (ansible#314)
Browse files Browse the repository at this point in the history
* Switch to `pull_request_target` for labeler
    This allows PRs from forks to edit the PR

* Add action to label issues
    Separate issue and PR labeler configs
  • Loading branch information
samdoran authored Dec 7, 2021
1 parent 8c25805 commit 6860160
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/issue-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
needs_triage:
- '.*'
11 changes: 0 additions & 11 deletions .github/labeler.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
needs_triage:
- '.*'
- '.*/*'
- '*'
- '*/*'

docs:
- docs/*

test:
- 'test/*'
25 changes: 16 additions & 9 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
name: Triage

permissions:
contents: read
pull-requests: write
issues: write

on:
issues:
types:
- opened
- reopened

pull_request:
types:
- opened
pull_request_target:

jobs:
triage:
runs-on: ubuntu-latest
name: Label

steps:
- name: Apply labels
- name: Label pull requests
uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/pr-labeler.yml
if: github.event_name == 'pull_request_target'

- name: Label issues
# This is the latest commit in the v2.4 branch. Waiting for a 2.4.1 or newer release.
# https://github.com/github/issue-labeler/issues/24
uses: github/issue-labeler@99b4c5dda477c65f4ef08486b73c5787e1e33601
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
not-before: 2021-12-07T07:00:00Z
configuration-path: .github/issue-labeler.yml
enable-versioned-regex: 0
if: github.event_name == 'issues'

0 comments on commit 6860160

Please sign in to comment.