labeler icon indicating copy to clipboard operation
labeler copied to clipboard

"Common Examples" fails to execute

Open kepikoi opened this issue 4 years ago • 14 comments

This action fails when using the "Common Examples" example from the readme:

workflows/label.yml:

# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration.  For more information, see:
# https://github.com/actions/labeler/blob/master/README.md

name: Labeler
on: [pull_request]

jobs:
  label:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/labeler@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

labeler.yml:

# Add 'repo' label to any root file changes
repo:
  - ./*

# Add '@domain/core' label to any change within the 'core' package
@domain/core:
  - package/core/*
  - package/core/**/*

# Add 'test' label to any change to *.spec.js files within the source dir
test:
  - src/**/*.spec.js

# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
source:
- any: ['src/**/*', '!src/docs/*']

# Add 'frontend` label to any change to *.js files as long as the `main.js` hasn't changed
frontend:
- any: ['src/**/*.js']
  all: ['!src/main.js']

yields following error in gh actions:

  Set up job5s
  Run actions/labeler@v21s
    ^
Run actions/labeler@v2
##[error]YAMLException: end of the stream or a document separator is expected at line 6, column 1:
    @domain/core:
    ^
##[error]end of the stream or a document separator is expected at line 6, column 1:
    @domain/core:
    ^
  Complete job

kepikoi avatar Jun 03 '20 14:06 kepikoi

I'm also seeing the examples fail, but differently.

source:
- any: ['src/**/*', '!src/docs/*']

run in isolation fails with:

##[error]TypeError: glob pattern string required
##[error]glob pattern string required

mattwills8 avatar Jun 04 '20 13:06 mattwills8

I'm also seeing the examples fail, but differently.

source:
- any: ['src/**/*', '!src/docs/*']

run in isolation fails with:

##[error]TypeError: glob pattern string required
##[error]glob pattern string required

I didn't mention this in my issue but the "any" and "all" directives are not working for me either

kepikoi avatar Jun 04 '20 13:06 kepikoi

The README is a bit outdated. any and all are only available on the master branch. You must use actions/labeler@master until it is officially released.

jalaziz avatar Jun 04 '20 18:06 jalaziz

So even with actions/labeler@master we cant use any and all on pull requests?

mattwills8 avatar Jun 04 '20 21:06 mattwills8

So even with actions/labeler@master we cant use any and all on pull requests?

To clarify, with actions/labeler@master, you CAN use any and all. I'm successfully using it.

jalaziz avatar Jun 04 '20 21:06 jalaziz

Ah perfect, I'll try it now, thanks

mattwills8 avatar Jun 04 '20 21:06 mattwills8

It works, thanks a lot!

mattwills8 avatar Jun 04 '20 22:06 mattwills8

@mattwills8 heads up that I found a bug my original logic. Filed #75 to fix it. I'm still testing it, but hopefully it'll land soon.

jalaziz avatar Jun 10 '20 09:06 jalaziz

Documentation update in #82.

TimothyGu avatar Jun 27 '20 01:06 TimothyGu

@jalaziz - Let's go ahead and update readme.md. It created lot of confusion for me to fix the glob pattern issue. Without looking at this issue it would have had very difficult for me to use -any.

Let me know your thoughts on this.

anandgupta193 avatar Jul 17 '20 08:07 anandgupta193

@anandgupta193 There's already a PR open for that. I don't have permissions to approve or merge PRs on this repo, so unfortunately, there's not much I can do.

jalaziz avatar Jul 17 '20 10:07 jalaziz

When will a release be created that allows us to use any and all? I'm trying to migrate my repos to this workflow from the deprecated probot autolabeleer (the apache spark repo to be correct), but it's difficult to use negations (!) properly without any and all support.

kbendick avatar Nov 04 '20 02:11 kbendick

Oddly, it looks like any/all was released https://github.com/marketplace/actions/labeler?version=v3 -- https://github.com/actions/labeler/commit/4b52aec09ba832eb9aecccddbccce644ba9ba69d lists v3.0.0

jsoref avatar Nov 11 '20 07:11 jsoref

For anyone facing the issue that @kepikoi mentioned (using @domain/core): It seems that the @ symbol is causing the error in the .yml parsing. Just remove the @ if you are getting this error:

##[error]YAMLException: end of the stream or a document separator is expected at line 6, column 1:
    @domain/core:
    ^

pomSense avatar Nov 24 '21 01:11 pomSense