labeler
labeler copied to clipboard
Support for output
I'm using this action as one step in a multi step (job actually) workflow. I would like to have this action label PRs based on the files changed, but subsequently assign reviewers based on those labels. Here is a sample of my workflow:
name: "PR Review Assigner"
on:
- pull_request
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/workflows/pr-review-assign/labeler.yml"
assign-reviewers:
needs: label
runs-on: ubuntu-latest
steps:
- name: "Print event"
env:
EVENT_CONTEXT: ${{ toJson(github.event.pull_request.labels) }}
run: echo "$EVENT_CONTEXT"
- name: "Assign NodeJS Review Candidate Team"
if: contains(github.event.pull_request.labels.*.name, 'nodejs-pr')
uses: kentaro-m/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/workflows/pr-review-assign/nodejs-pr.yml"
- name: "Assign App Review Candidate Team"
if: contains(github.event.pull_request.labels.*.name, 'app-pr')
uses: kentaro-m/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/workflows/pr-review-assign/app-pr.yml"
- name: "Assign Editor Review Candidate Team"
if: contains(github.event.pull_request.labels.*.name, 'editor-pr')
uses: kentaro-m/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/workflows/pr-review-assign/editor-pr.yml"
The problem here is that the github.event.pull_request
object is created before the entire workflow runs and is not updated when this specific action runs. So github.event.pull_request.labels
is not affected by this action.
One solution would be for this action to produce an output of the labels changed (or better yet, the labels of the PR) so that it can be used in subsequent jobs that run sequentially.
Thanks!
FYI: I made PR for this: https://github.com/actions/labeler/pull/60
We've made the change locally and are using it happily. Would love to get this PR in and switch back to using the official action. Thanks!
Another use-case for this is to run different unit-tests in the CI based on the updated labels. E.g. run back-end v.s. front-end tests or build different docker images.
Any way to get that out? I see a couple of forks that added that behaviour, is there anything preventing that to go through? @MaksimZhukov ? Thank you :)
Hi. I am also wanting to see outputs in the official labeler action rather than using a fork. Thank you.
Hello everyone! We have released a new action version that includes this feature. Please find details in the release notes. Thank you all for the patience!