diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 6c7ebbb..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,4 +0,0 @@ -'PR: waiting for review': - - '*' - - '.github/**/*' - - 'src/**/*' diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 0000000..82202d6 --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,3 @@ +'PR: waiting for review': +- changed-files: + - any-glob-to-any-file: '**' diff --git a/.github/workflows/conflicts.yml b/.github/workflows/conflicts.yml index 63b208e..b2c6403 100644 --- a/.github/workflows/conflicts.yml +++ b/.github/workflows/conflicts.yml @@ -7,9 +7,6 @@ on: # In `pull_request` we wouldn't be able to change labels of fork PRs pull_request_target: types: [synchronize] - workflow_run: - workflows: ['Dummy workflow for conflicts'] - types: [requested] jobs: main: diff --git a/.github/workflows/dummy-conflicts.yml b/.github/workflows/dummy-conflicts.yml deleted file mode 100644 index ed1fa3f..0000000 --- a/.github/workflows/dummy-conflicts.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Dummy workflow for conflicts -on: - pull_request_review: - types: [submitted] -jobs: - dummy: - runs-on: ubuntu-latest - steps: - - run: echo "this is a dummy workflow that triggers a workflow_run; it's necessary because otherwise the repo secrets will not be in scope for externally forked pull requests" diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index 492a3ab..5c9c992 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -1,7 +1,7 @@ name: "Pull Request Labeler" on: pull_request_target: - types: [opened, reopened] + types: [opened, reopened, ready_for_review] jobs: triage: @@ -9,7 +9,9 @@ jobs: contents: read pull-requests: write runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + configuration-path: .github/pr-labeler.yml diff --git a/.github/workflows/remove-outdated-labels.yml b/.github/workflows/remove-outdated-labels.yml index 722218c..00347d7 100644 --- a/.github/workflows/remove-outdated-labels.yml +++ b/.github/workflows/remove-outdated-labels.yml @@ -1,9 +1,10 @@ name: Remove outdated labels on: - # https://github.community/t/github-actions-are-severely-limited-on-prs/18179/15 pull_request_target: types: - closed + - converted_to_draft + - ready_for_review jobs: remove-merged-pr-labels: name: Remove merged pull request labels @@ -19,10 +20,11 @@ jobs: PR: changes requested PR: merge conflicts / rebase needed PR/Issue: dependent + PR: stale remove-closed-pr-labels: name: Remove closed pull request labels - if: github.event_name == 'pull_request_target' && (! github.event.pull_request.merged) + if: github.event_name == 'pull_request_target' && (! github.event.pull_request.merged) && (github.event.action != 'converted_to_draft') && (github.event.action != 'ready_for_review') runs-on: ubuntu-latest steps: - uses: mondeja/remove-labels-gh-action@v1.1.1 @@ -33,4 +35,27 @@ jobs: PR: WIP PR: changes requested PR: merge conflicts / rebase needed - PR/Issue: dependent + PR/Issue: dependent + PR: stale + + remove-draft-pr-labels: + name: Remove labels from draft pull requests + if: github.event_name == 'pull_request_target' && github.event.action == 'converted_to_draft' + runs-on: ubuntu-latest + steps: + - uses: mondeja/remove-labels-gh-action@v1.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: | + PR: waiting for review + + remove-ready-pr-labels: + name: Remove labels when draft pr is marked ready for review + if: github.event_name == 'pull_request_target' && github.event.action == 'ready_for_review' + runs-on: ubuntu-latest + steps: + - uses: mondeja/remove-labels-gh-action@v1.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: | + PR: WIP