srvaroa / labeler Goto Github PK
View Code? Open in Web Editor NEWLabel manager for PRs and Issues based on configurable conditions
Home Page: https://github.com/srvaroa/labeler
License: MIT License
Label manager for PRs and Issues based on configurable conditions
Home Page: https://github.com/srvaroa/labeler
License: MIT License
I've noticed releases are consistently bumped a minor version, even when the release doesn't contain any new functionality. For example 1.3 -> 1.4 seems to only contain chores/dependency updates . Would it be a good idea to start adhering to semantic versioning?
Major (1.x.x -> 2.x.x) version when we make incompatible API changes
Minor (x.1.x -> x.2.x) version when we add functionality in a backwards compatible manner
Patch (x.x.1 -> x.x.2) version when we make backwards compatible bug fixes and chores
Logs from GH action:
2022/07/26 13:26:48 Matching `^fix\(.*\)[^!]((?!BREAKING\sCHANGE).)*$` against: `fix(.github/labeler.yml): labels not being applied correctly [CDS-000]`
2022/07/26 13:26:48 release-as-fix: condition Title matches regex yields false
Label config
version: 1
labels:
// Other labels
- label: 'release-as-fix'
title: '^fix\(.*\)[^!]((?!BREAKING\sCHANGE).)*$'
^fix\(.*\)[^!]((?!BREAKING\sCHANGE).)*$
fix(.github/labeler.yml): labels not being applied correctly [CDS-000]
If using a tool like https://regex101.com/ , you can verify that the PR title should match the regex
[2/3] RUN wget -q -O- https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz | tar xzvf -:
0.745 wget: server returned error: HTTP/1.1 404 Not Found
0.747 tar: invalid magic
0.747 tar: short read
10 | WORKDIR /
11 | ARG ASSET_URL=https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz
12 | >>> RUN wget -q -O- $ASSET_URL | tar xzvf -
13 | ENTRYPOINT ["/action"]
14 |
ERROR: failed to solve: process "/bin/sh -c wget -q -O- $ASSET_URL | tar xzvf -" did not complete successfully: exit code: 1
Error: Docker build failed with exit code 1
With action runners, it is generally considered bad practice to use @master
as that will get you (the action user) into trouble when the action releases/is working on a new major version.
However, using a specific tag or even a specific commit @v1.7.1
means you continuously have to update the workflow. This is made easier with Dependabot, but still a pain in the neck.
To work-around this, a lot of action runners have a "moving" tag for each major. For this repo that would currently be v1
, this tag would always be at the last tagged release of the 1.x range of releases.
By the time, a new major would be released, a new, moving v2
tag would then be added, which does the same for the 2.x range of releases.
That way, end-users only have to update their workflow on new majors (from @v1
to @v2
), which Dependabot can handle, and they can avoid using @master
and prevent unexpected surprises.
Would you be willing to consider this ?
@srvaroa https://github.com/srvaroa/labeler/actions/runs/6943962687 the release didn't work properly so the actions weren't created. Referring to the missing actions tar in the release downloads here: https://github.com/srvaroa/labeler/releases/tag/v1.8.0
Here's the failing action: https://github.com/srvaroa/labeler/actions/runs/6943962687
Originally posted by @mjfwebb in #113 (comment)
Since around yesterday the action is failing to build the docker container and thus run the action itself.
If I am not mistaken there is already a pr in place (#37) to switch to a JavaScript based action.
It would be great if it supported labeler.yml files that are auto generated on build time, and only fallback to fetching it through HTTP if it is not present locally.
Right now it seems unable to get it from a local file.
Is there an option to add label based on target branch in pull request? For example if target branch is release/x.x.x
I would like to have label release
on Pull request.
Since this was inspired from the original lableler that did support file paths, is this something that could be added here?
Hi!
Have you ever considered extending label customization? For instance, one could define (in labeler.yml
) a color and/or description of the labels when applying the rules.
labels:
- label: "๐ง chore"
color: "202020"
description: "Configuration, codebase maintenance tools"
files:
- '\.editorconfig'
- '\.gitignore'
Thanks!
By the way: Thanks for developing and maintaining the action! It's great! ๐๐ป ๐๐ป
... and where can I find the documentation of the supported syntaxes for this regex flavour ?
It would be good if a link to that documentation could be added to the README.
The problem I was trying to solve is as follows:
In a PR template there is a block like this:
## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix _(non-breaking change which fixes an issue)_
- [ ] New feature _(non-breaking change which adds functionality)_
- [ ] Breaking change _(fix or feature that would cause existing functionality to change)_
- [ ] This change is only breaking for integrators, not for external standards or end-users.
- [ ] Documentation improvement
... which means that if people fill out the template correctly, the PR will have an [x]
for one of these, like so:
- [x] Bug fix _(non-breaking change which fixes an issue)_
I'm trying to attach a label to a PR based on this, so I have a section in labeler.yml
which looks like this:
- label: "Type: bug"
body: "x\] Bug fix"
- label: "Type: enhancement"
body: "x\] New feature"
As you can see I'm slash-escaping the ]
character as it is (normally) a special character in regex.
When that workflow runs though, it silently fails with the following error (where line 79 is one of the body:...
lines):
2023/11/10 18:19:14 Unable to unmarshall config yaml: line 79: found unknown escape character:
2023/11/10 18:19:14 Unable to unmarshall legacy config: yaml: line 79: found unknown escape character
2023/11/10 18:19:14 Unable to unmarshall legacy config yaml: line 79: found unknown escape character:
2023/11/10 18:19:14 Unable to parse configuration
What makes this extra awkward is that testing the workflow is difficult as I set it up to only run on pull_request_target
(and only when a PR is opened), which meant that the workflow run for the PR which made the change to the labeler.yml
file ran without issues as it was using the previous version of the labeler.yml
file, meaning I only noticed the problem when the next PR was opened.
I tried adding fail_on_error: true
, but that gave me an Warning: Unexpected input(s) 'fail_on_error', valid inputs are ['entryPoint', 'args', 'config_path', 'use_local_config']
error.
And even if it had worked, adding fail_on_error: true
wouldn't have changed anything as in that case, it would still have been the next PR on which the workflow run would have failed.
Adding something like the below (with config for yamllint) would probably have caught it, but it is a bit roundabout that I need an extra job to make sure changes to the set up of this job will work.
yamllint:
name: 'Lint Yaml'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Yamllint on all yaml files in repo
run: yamllint . --format colored --strict
- name: Pipe Yamllint results on to GH for inline display
if: ${{ failure() }}
run: yamllint . --format github --strict
Either way, a couple of hours of debugging has led me to a solution: use single quotes for those regexes instead of double quotes. It wasn't so much a regex issue, but actually a Yaml issue, where Yaml would get confused by the escaping.
Either way, even though I solved my own issue by now, I'm going to open this issue anyway for two reasons:
When I tried to use srvaroa/labeler
action in GitHub Server, I got the error message like below.
GET https://api.github.com/repos/${my-org}/${my-repo}/contents/.github/labeler.yaml?ref=xxxxxxxxxxx: 401 Bad credentials []
I think that configuration for GITHUB_API_HOST is need to support GitHub Enterprise Server.
This feature request is for the ability to use regex capture groups to name the labels dynamically.
Imagine the following repository folder structure and I want all PR's to have an area/<area>
label, which value should be based on the subfolder that the PR brings changes to.
k8s/ingress/...
k8s/rbac/...
k8s/config/...
k8s/dns/...
k8s/istio/...
network/...
Currently, I need to configure each possible label manually:
labels:
- label: "area/k8s-ingress"
files:
- "k8s/ingress/.*"
- label: "area/k8s-rbac"
files:
- "k8s/rbac/.*"
- label: "area/k8s-config"
files:
- "k8s/config/.*"
- label: "area/k8s-dns"
files:
- "k8s/dns/.*"
- label: "area/k8s-istio"
files:
- "k8s/istio/.*"
- label: "area/network"
files:
- "network/.*"
With the ability to use regex capture groups to name the labels dynamically, my configuration could be reduced to:
labels:
- label: "area/k8s-$1"
files:
- "k8s/(.*)/.*"
- label: "area/network"
files:
- "network/.*"
Nice to see that your back at it and releasing new features @srvaroa ๐ฅWe love this project in our team.
Since v1.6.2 was released, we are not able to run this action, failing on docker build:
#0 building with "default" instance using docker driver
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 607B done
#2 DONE 0.0s
#3 [auth] library/alpine:pull token for registry-1.docker.io
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/alpine:3.17.2
#4 DONE 0.5s
#5 [1/3] FROM docker.io/library/alpine:3.17.2@sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517
#5 resolve docker.io/library/alpine:3.17.2@sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517 done
#5 extracting sha256:63b65145d645c1250c391b2d16ebe53b3747c295ca8ba2fcb6b0cf064a4dc21c 0.1s
#5 sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517 1.64kB / 1.64kB done
#5 sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501 528B / 528B done
#5 sha256:b2aa39c304c27b96c1fef0c06bee651ac9241d49c4fe34381cab8453f9a89c7d 1.47kB / 1.47kB done
#5 sha256:63b65145d645c1250c391b2d16ebe53b3747c295ca8ba2fcb6b0cf064a4dc21c 3.37MB / 3.37MB 0.1s done
#5 extracting sha256:63b65145d645c1250c391b2d16ebe53b3747c295ca8ba2fcb6b0cf064a4dc21c 0.1s done
#5 DONE 0.3s
#6 [2/3] RUN wget -q -O- https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz | tar xzvf -
#6 0.341 wget: server returned error: HTTP/1.1 404 Not Found
#6 0.342 tar: invalid magic
#6 0.342 tar: short read
#6 ERROR: process "/bin/sh -c wget -q -O- $ASSET_URL | tar xzvf -" did not complete successfully: exit code: 1
------
> [2/3] RUN wget -q -O- https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz | tar xzvf -:
0.341 wget: server returned error: HTTP/1.1 404 Not Found
0.342 tar: invalid magic
0.342 tar: short read
------
Dockerfile:12
--------------------
10 | WORKDIR /
11 | ARG ASSET_URL=https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz
12 | >>> RUN wget -q -O- $ASSET_URL | tar xzvf -
13 | ENTRYPOINT ["/action"]
14 |
--------------------
ERROR: failed to solve: process "/bin/sh -c wget -q -O- $ASSET_URL | tar xzvf -" did not complete successfully: exit code: 1
Warning: Docker build failed with exit code 1, back off 1.424 seconds before retry.
This looks caused by 404 error returned by GitHub, downloading the source code archive.
#6 [2/3] RUN wget -q -O- https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz | tar xzvf -
#6 0.341 wget: server returned error: HTTP/1.1 404 Not Found
#6 0.342 tar: invalid magic
#6 0.342 tar: short read
#6 ERROR: process "/bin/sh -c wget -q -O- $ASSET_URL | tar xzvf -" did not complete successfully: exit code: 1
labeler.yml
version: 1
labels:
- label: "env/dev"
files:
- "clusters/dev/.*"
- label: "env/staging"
files:
- "clusters/staging/.*"
- label: "env/prod"
files:
- "clusters/prod/.*"
- label: "infra/observability-platform"
files:
- "clusters/dev/observability/.*"
- "clusters/staging/observability/.*"
- "clusters/prod/observability/.*"
When I changed clusters/dev/observability/test.yaml
in PR, the action does not add env/dev
and infra/observability-platform
labels.
I think getPrFileNames
function is broken.
2020/10/15 17:37:50 Trigger event: pull_request
2020/10/15 17:37:50 env/dev: condition Title matches regex skipped (title is not set in config)
2020/10/15 17:37:50 env/dev: condition Branch matches regex skipped (branch is not set in config)
2020/10/15 17:37:50 env/dev: condition Pull Request is mergeable skipped (mergeable is not set in config)
2020/10/15 17:37:50 env/dev: condition Pull Request contains a number of changes skipped (size-above and size-below are not set in config)
2020/10/15 17:37:50 Matching `clusters/dev/.*` against:
2020/10/15 17:37:50 env/dev: condition File matches regex yields false
2020/10/15 17:37:50 env/staging: condition Title matches regex skipped (title is not set in config)
2020/10/15 17:37:50 env/staging: condition Branch matches regex skipped (branch is not set in config)
2020/10/15 17:37:50 env/staging: condition Pull Request is mergeable skipped (mergeable is not set in config)
2020/10/15 17:37:50 env/staging: condition Pull Request contains a number of changes skipped (size-above and size-below are not set in config)
2020/10/15 17:37:50 Matching `clusters/staging/.*` against:
2020/10/15 17:37:50 env/staging: condition File matches regex yields false
2020/10/15 17:37:50 env/prod: condition Title matches regex skipped (title is not set in config)
2020/10/15 17:37:50 env/prod: condition Branch matches regex skipped (branch is not set in config)
2020/10/15 17:37:50 env/prod: condition Pull Request is mergeable skipped (mergeable is not set in config)
2020/10/15 17:37:50 env/prod: condition Pull Request contains a number of changes skipped (size-above and size-below are not set in config)
2020/10/15 17:37:50 Matching `clusters/prod/.*` against:
2020/10/15 17:37:50 env/prod: condition File matches regex yields false
2020/10/15 17:37:50 infra/observability-platform: condition Title matches regex skipped (title is not set in config)
2020/10/15 17:37:50 infra/observability-platform: condition Branch matches regex skipped (branch is not set in config)
2020/10/15 17:37:50 infra/observability-platform: condition Pull Request is mergeable skipped (mergeable is not set in config)
2020/10/15 17:37:50 infra/observability-platform: condition Pull Request contains a number of changes skipped (size-above and size-below are not set in config)
2020/10/15 17:37:50 Matching `clusters/dev/observability/.*, clusters/staging/observability/.*, clusters/prod/observability/.*` against:
2020/10/15 17:37:50 infra/observability-platform: condition File matches regex yields false
2020/10/15 17:37:51 Desired labels: []
as far as I understand, you can only determine between mergeable true/false, but it would be also nice to check whether it is a draft PR or not.
I am attempting to use your action as a workaround as Github has yet to integrate yaml features into its pull request templates as it has with its issue templates. As I am using a pull request template with some markdown options. It would be great if I could do more than just the title and regex on a text option within the description.
Hello! Thanks for the great action! This is a feature request -- if you're not open to those, no worries!
In some teams, people merge their own PRs once they are approved. However, when people without write access to the repo open a PR, someone on the team (that is, someone with merge permissions) needs to merge it because the author can't.
In such cases, it would be helpful to label PRs based on whether the author has write access.
The labeler
action creates the corresponding labels in GitHub
if not already created when matches are found. Although this might mean less work is needed to create labels, it also means that a PR might create arbitrary labels if the configuration file is modified in that PR. Some organizations may prefer to avoid this and to have a single way to create labels or more control over them. Also, because that somehow breaks the permission criterion that is required to create a new label on a GitHub
repository.
Maybe an option could be added to the configuration of the action preventing it from creating a label if it does not exist in GitHub
.
Following #13 (comment).
This action started failing around 2022-11-02 2:00 PM GMT +1. Looks like some dependencies are no longer working.
Step 1/13 : FROM golang:1.12-alpine
1.12-alpine: Pulling from library/golang
c9b1b535fdd9: Pulling fs layer
cbb0d8da1b30: Pulling fs layer
d909eff28200: Pulling fs layer
65fbbf998e4: Pulling fs layer
4985b1919860: Pulling fs layer
665fbbf998e4: Waiting
4985b1919860: Waiting
d909eff28200: Verifying Checksum
d909eff28200: Download complete
cbb0d8da1b30: Download complete
c9b1b535fdd9: Verifying Checksum
c9b1b535fdd9: Download complete
4985b1919860: Verifying Checksum
4985b1919860: Download complete
c9b1b535fdd9: Pull complete
cbb0d8da1b30: Pull complete
d909eff28200: Pull complete
665fbbf998e4: Verifying Checksum
665fbbf998e4: Download complete
665fbbf998e4: Pull complete
4985b1919860: Pull complete
...
Status: Downloaded newer image for golang:1.12-alpine
---> 76bddfb5e55e
Step 2/13 : LABEL "com.github.actions.name"="Condition-based Pull Request labeller"
---> Running in d7e8e1e1d96d
Removing intermediate container d7e8e1e1d96d
---> 3a69bfae59ae
Step 3/13 : LABEL "com.github.actions.description"="Automatically label pull requests based on rules"
---> Running in 557ee9d71787
Removing intermediate container 557ee9d71787
---> cfee7ab77b99
Step 4/13 : LABEL "com.github.actions.icon"="award"
---> Running in b4c4e2be8a42
Removing intermediate container b4c4e2be8a42
---> 8c2b796be492
Step 5/13 : LABEL "com.github.actions.color"="blue"
---> Running in 0e78c83162c1
Removing intermediate container 0e78c83162c1
---> e1f9415159b9
Step 6/13 : LABEL "maintainer"="Galo Navarro <[email protected]>"
---> Running in 92dfc6f9dd65
Removing intermediate container 92dfc6f9dd65
---> f232c1fa9125
Step 7/13 : LABEL "repository"="https://github.com/srvaroa/labeler"
---> Running in d6f5e6c6be37
Removing intermediate container d6f5e6c6be37
---> 3cf12f3bbfeb
Step 8/13 : RUN apk add --no-cache git
---> Running in bf2fb35b135b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/5) Installing nghttp2-libs (1.40.0-r1)
(2/5) Installing libcurl (7.79.1-r0)
(3/5) Installing expat (2.2.9-r1)
(4/5) Installing pcre2
(5/5) Installing git (2.24.4-r0)
Executing busybox-1.31.1-r9.trigger
OK: 22 MiB in 20 packages
Removing intermediate container bf2fb35b135b
---> ccd2c329c686
Step 9/13 : WORKDIR /go/src/app
---> Running in 33f29b7231d8
Removing intermediate container 33f29b7231d8
---> 9fb3f46fbcf0
Step 10/13 : COPY . .
---> dfee6becf25a
Step 11
---> Running in .......
Removing intermediate container 725a8b20a12e
---> 28b61547f99e
Step 12/13: RUN go build -o action ./cmd
---> Running in e08e6f671b53
go: finding github.com/waigani/diffparser v0.0.0-20190828052634-7391f219313d
go: finding github.com/google/go-github/v35 v35.0.0
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/google/go-cmp v0.3.1
go: finding github.com/go-yaml/yaml v2.1.0+incompatible
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/stretchr/testify v1.4.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/kr/text v0.1.0
go: finding github.com/google/go-querystring v1.0.0
go: finding github.com/golang/protobuf v1.3.2
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding github.com/kr/pty v1.1.1
go: finding google.golang.org/appengine v1.1.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/stretchr/objx v0.1.0
go: finding golang.org/x/sys v0.0.0-20190215 14 2949-d0b11bdaac8a
go: finding golang.org/x/text v0.3.0
go: gopkg.in/[email protected] 17 <REDACTED>: unrecognized import path "gopkg.in/check.v1" (parse https://gopkg.in/check.v1?go-get=1: no go-import meta tags ())
go: gopkg.in/[email protected]: unrecognized import path "gopkg.in/yaml.v2" (parse https://gopkg.in/yaml.v2?go-get=1: no go-import meta tags ())
go: error loading module requirements
The command '/bin/sh -c go build -o action ./cmd' returned a non-zero code: 1
As mentioned in passing in #105 :
I tried adding
fail_on_error: true
, but that gave me anWarning: Unexpected input(s) 'fail_on_error', valid inputs are ['entryPoint', 'args', 'config_path', 'use_local_config']
error.
The workflow I used while debugging the issue looked like this:
jobs:
label-new-prs:
runs-on: ubuntu-latest
steps:
# Checkout is needed to use the `use_local_config` option.
- name: Checkout code
uses: actions/checkout@v3
- uses: srvaroa/labeler@master
with:
use_local_config: true
fail_on_error: true
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Also note my comment about the need for checkout
when using the use_local_config
option. That might be something to mention in the README.
I am using srvaroa/labeler v0.9 in my CI and currently it fails building the Docker image. I guess this could be solved when merging #37 and using pre-built Docker images?
Log:
Build container for action use: '/home/runner/work/_actions/srvaroa/labeler/v0.9/Dockerfile'.
/usr/bin/docker build -t 290506:94c24731891c41c6b2a31b0c9a4f52f3 -f "/home/runner/work/_actions/srvaroa/labeler/v0.9/Dockerfile" "/home/runner/work/_actions/srvaroa/labeler/v0.9"
Sending build context to Docker daemon 221.7kB
Step 1/13 : FROM golang:1.12-alpine
1.12-alpine: Pulling from library/golang
c9b1b535fdd9: Pulling fs layer
cbb0d8da1b30: Pulling fs layer
d909eff28200: Pulling fs layer
665fbbf998e4: Pulling fs layer
4985b1919860: Pulling fs layer
665fbbf998e4: Waiting
4985b1919860: Waiting
d909eff28200: Verifying Checksum
d909eff28200: Download complete
cbb0d8da1b30: Download complete
c9b1b535fdd9: Verifying Checksum
c9b1b535fdd9: Download complete
4985b1919860: Verifying Checksum
4985b1919860: Download complete
c9b1b535fdd9: Pull complete
cbb0d8da1b30: Pull complete
d909eff28200: Pull complete
665fbbf998e4: Verifying Checksum
665fbbf998e4: Download complete
665fbbf998e4: Pull complete
4985b1919860: Pull complete
Digest: sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a
Status: Downloaded newer image for golang:1.12-alpine
---> 76bddfb5e55e
Step 2/13 : LABEL "com.github.actions.name"="Condition-based Pull Request labeller"
---> Running in e65964e0a32b
Removing intermediate container e65964e0a32b
---> 24e9f7cfc8e3
Step 3/13 : LABEL "com.github.actions.description"="Automatically label pull requests based on rules"
---> Running in 18bffe79951d
Removing intermediate container 18bffe79951d
---> 93ad46f7ba89
Step 4/13 : LABEL "com.github.actions.icon"="award"
---> Running in 4eceab94f037
Removing intermediate container 4eceab94f037
---> 2eba8c80ab15
Step 5/13 : LABEL "com.github.actions.color"="blue"
---> Running in 5973104a2fcd
Removing intermediate container 5973104a2fcd
---> f58a8788c860
Step 6/13 : LABEL "maintainer"="Galo Navarro <[email protected]>"
---> Running in 3a460aefa249
Removing intermediate container 3a460aefa249
---> 04c5e4888812
Step 7/13 : LABEL "repository"="https://github.com/srvaroa/labeler"
---> Running in 6598618cbbe4
Removing intermediate container 6598618cbbe4
---> ef2f2ce1c1f9
Step 8/13 : RUN apk add --no-cache git
---> Running in a0a2baa2d0b1
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/5) Installing nghttp2-libs (1.40.0-r1)
(2/5) Installing libcurl (7.79.1-r0)
(3/5) Installing expat (2.2.9-r1)
(4/5) Installing pcre2 (10.34-r1)
(5/5) Installing git (2.24.4-r0)
Executing busybox-1.31.1-r9.trigger
OK: 22 MiB in 20 packages
Removing intermediate container a0a2baa2d0b1
---> 5928e15e1ea2
Step 9/13 : WORKDIR /go/src/app
---> Running in 987055ae864c
Removing intermediate container 987055ae864c
---> ca662ad64c9b
Step 10/13 : COPY . .
---> 069e58d07a80
Step 11/13 : ENV GO111MODULE=on
---> Running in da98b524599b
Removing intermediate container da98b524599b
---> b3c6dc400c98
Step 12/13 : RUN go build -o action ./cmd
---> Running in 3194f118be58
go: finding github.com/google/go-cmp v0.3.1
go: finding github.com/waigani/diffparser v0.0.0-20190828052634-7391f219313d
go: finding github.com/go-yaml/yaml v2.1.0+incompatible
go: finding github.com/google/go-github/v35 v35.0.0
go: finding github.com/kr/pretty v0.1.0
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/kr/text v0.1.0
go: finding github.com/stretchr/testify v1.4.0
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/golang/protobuf v1.3.2
go: finding github.com/google/go-querystring v1.0.0
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding github.com/kr/pty v1.1.1
go: finding google.golang.org/appengine v1.1.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/stretchr/objx v0.1.0
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding golang.org/x/text v0.3.0
go: gopkg.in/[email protected]: unrecognized import path "gopkg.in/check.v1" (parse https://gopkg.in/check.v1?go-get=1: no go-import meta tags ())
go: gopkg.in/[email protected]: unrecognized import path "gopkg.in/yaml.v2" (parse https://gopkg.in/yaml.v2?go-get=1: no go-import meta tags ())
go: error loading module requirements
The command '/bin/sh -c go build -o action ./cmd' returned a non-zero code: 1
Warning: Docker build failed with exit code 1, back off 8.645 seconds before retry.
We just ran into an issue where if you have multiple matchers (in our case title and file paths) then the results of the last matcher are used. So in our case the title matcher returned true
and the file path matcher returned false
and the label was not applied.
Hiya,
As one of the criteria in a labeler.yml
file, I have the following:
labels:
- label: "Status: triage"
draft: false
author-can-merge: false
The Status: triage
label to be added to all non-draft PRs where the author doesn't have commit rights in the repo.
The Status: triage
label does not get added to PRs from outside contributors (who don't have commit rights to the repo).
I haven't tested yet if it works when I set it as follows, but if it does, I'd still find that counter-intuitive, as I'd expect author-can-merge: false
to be respected.
labels:
- label: "Status: triage"
negate: true
draft: false
author-can-merge: true
This is from the last build in this repo ๐ฌ It looks like it's having issues reading the Version
and first -Label
entries
Run srvaroa/labeler@master
/usr/bin/docker run --name e5ae59d1f3a1a7557a4a3c97c3fd304f80e925_9d3c39 --label e5ae59 --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_CONFIG_PATH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/labeler/labeler":"/github/workspace" e5ae59:d1f3a1a7557a4a3c97c3fd304f80e925
2020/09/12 20:07:29 Loaded config from srvaroa/labeler@421f6f7073c5b3ade085d9270db61132fe2e627e:.github/labeler.yml
--
Version: 1
Labels:
- Label: "TestLabel"
title: ".*"
- Label: "TestFileMatch"
files:
- "cmd/.*.go"
- "pkg/.*.go"
2020/09/12 20:07:29 Unable to unmarshall config --
&Version: 1
Labels:
- Label: "TestLabel"
title: ".*"
- Label: "TestFileMatch"
files:
- "cmd/.*.go"
- "pkg/.*.go"
Rather than maintaining a separate list of members in this config file, it would be great to be able to reference a Github team that is already maintained to have an accurate list of authors. This is similar to the functionality available in Auto Request Review by using the prefix team:
. If this is already possible, I'd love to know how!
Hi, first of all, thanks for that solution ๐
In one of my repositories, I would like to define a list of available branch types. And if someone created a branch and has opened a PR with a name that does not match any conditions I would like to add an unknown
label.
I tried to do that via my own conditions
- label: "unknown"
branch: "^((?!feature|bugfix).)*$"
but then realize that it does not work since Go
regex does not support ?!
๐
I have added this GitHub action to my repo with the event type: pull_request_target
instead of pull_request
. This seems to run on the base repository as expected but I get the following error message:
2020/09/11 18:18:35 Trigger event: pull_request_target
2020/09/11 18:18:35 Unable to execute action: unknown X-Github-Event in message: pull_request_target
Is there anyway this can be supported?
This is something mergify has... The request would be based on the branch name, a label could be applied
No labels were added for files changed within submodules. Can support please be added? Thanks!
i need to filter some changed files in specific directory but the applied regex not working even I tested on https://regex101.com/
- "(.*?)\/(addressbook|travelrules|walletsigning)\/.*"
This action is awesome! It works perfectly for PRs but I've noticed it doesn't work for issues. Investigating how to support this for issues as well and will try to raise a PR.
I'm experimenting with this action at the moment and noticed the following:
labeler.yml
file containing the following:version: 1
appendOnly: true
labels:
- label: "Status: triage"
draft: False
author-can-merge: False
- label: "Type: bug"
draft: False
body: ".* bug .*"
- label: "Type: documentation"
draft: False
files:
- "/Docs/[A-Za-z0-9-]*/.*Standard.xml$"
When a new PR is opened and the Type: bug
label is manually added, but the body of the PR does not contain the term "bug" (though the title does), the Type: bug
label is removed from the PR by the workflow.
Same thing with the Type: documentation
label. If this was manually added on creating the PR, the workflow removes it when the files
regex doesn't match any files.
... the appendOnly: true
setting to prevent this from happening.
Please let me know if you need more information and thank you for creating this action runner!
I'd like to be able to apply labels only if none have been manually set by the author of the PR. If this is already possible, I'd love to know how!
I am wondering whether regex patterns that have both include/exclude parts are correctly handled.
I would like to be able to mark all files whose path matches a pattern with a label, but to avoid apply a different label to files that share only part of the path.
As an example, I have a label named area:Book
that I'd like to apply to all *.tex
files under the SoftwareGuide/Latex
path:
area:Book:
files:
- "SoftwareGuide/Latex/*.tex"
At the same time, I have a label named type:BookStyle
that should apply to all files under the Latex
path, but not to the files under SoftwareGuide/Latex
. Using the pattern below:
type:BookStyle:
files:
- "Latex/*"
will add both labels to a file like SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex
added in a commit.
I am wondering whether modifying the second rule to
type:BookStyle:
files:
- "^Latex/[^/]*"
would avoid applying the type:BookStyle
label to SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex
.
Cross-referencing:
InsightSoftwareConsortium/ITKSoftwareGuide#167
Thanks and sorry to ask a question by opening an issue.
Please provide an option to append labels to the already existing labels on a PR.
Currently it removes all existing labels from a PR and applies those which meet the conditions. But, there are use cases where people want to manually add labels to the PR and maintain it.
Thanks for implementing and sharing this nice Action ๐ ๐
Currently, the action will fail on forked pull requests per the GitHub Action permission limitations:
Could it be possible to run in a scheduled mode, i.e. cron, by examining open pull requests and labelling them?
Or, not fail when the required permissions are not available?
Sometimes I want to be able to not include certain files in the calculation for number of changes.
For example, when yarn.lock
gets updated, it can typically include many changes that blows up the PR size condition. It would be awesome if somewhere I could list files that I don't want included in that calculation.
๐๐ป
The Dockerfile used to fetch the binary used for the action references latest
in all recent versions.
ARG ASSET_URL=https://github.com/srvaroa/labeler/releases/latest/download/action.tar.gz
This is not great because it put the labeler action out of commision for all releases of the action, when the 1.6.2 release failed to create the action.tar.gz
file in "latest" downloads location.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.