Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for output #59

Closed
danielsht86 opened this issue Mar 20, 2020 · 5 comments
Closed

Support for output #59

danielsht86 opened this issue Mar 20, 2020 · 5 comments
Labels
feature request New feature or request to improve the current logic

Comments

@danielsht86
Copy link
Contributor

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/auto-assign-action@v1.1.0
        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/auto-assign-action@v1.1.0
        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/auto-assign-action@v1.1.0
        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!

@danielsht86
Copy link
Contributor Author

FYI: I made PR for this: #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!

@smyrman
Copy link

smyrman commented Sep 23, 2020

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.

@onx2 onx2 mentioned this issue Sep 11, 2021
@MaksimZhukov MaksimZhukov added the feature request New feature or request to improve the current logic label Dec 12, 2022
@maxime-gaudron
Copy link

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 :)

@tewing
Copy link

tewing commented May 12, 2023

Hi. I am also wanting to see outputs in the official labeler action rather than using a fork. Thank you.

@MaksimZhukov
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

5 participants