Skip to content
Closed
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
40 changes: 40 additions & 0 deletions .github/workflows/stackhpc-pull-request-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Auto-label Pull Requests
'on':
pull_request:
types:
- opened
- reopened
- ready_for_review
- converted_to_draft

jobs:
auto-label:
runs-on: ubuntu-latest
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
permissions:
pull-requests: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:

- name: Add waiting-review label (New Ready PR)
if: (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request.draft == false
run: gh pr edit "$PR_NUMBER" --add-label "waiting-review"

- name: Add waiting-author-response label (New Draft PR)
if: (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request.draft == true
run: gh pr edit "$PR_NUMBER" --add-label "waiting-author-response"

- name: Switch labels when PR becomes Ready for Review
if: github.event.action == 'ready_for_review'
run: |
gh pr edit "$PR_NUMBER" --remove-label "waiting-author-response" || true
gh pr edit "$PR_NUMBER" --add-label "waiting-review"

- name: Switch labels when PR is converted back to Draft
if: github.event.action == 'converted_to_draft'
run: |
gh pr edit "$PR_NUMBER" --remove-label "waiting-review" || true
gh pr edit "$PR_NUMBER" --add-label "waiting-author-response"
14 changes: 0 additions & 14 deletions .github/workflows/stackhpc-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ name: Pull request
'on':
pull_request:
jobs:
# Label all newly-opened PRs as "waiting-review"
auto-label:
runs-on: ubuntu-latest
if: github.event.action == 'opened' && github.repository == 'stackhpc/stackhpc-kayobe-config'
permissions:
pull-requests: write
steps:
- name: Add waiting-review label
run: gh pr edit "$PR_NUMBER" --add-label "waiting-review"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}

# Detect which files have changed and use this to run jobs conditionally.
# Note that we can't use the workflow-level paths attribute since this
# would skip the workflow entirely, and would prevent us from making the
Expand Down
Loading