Coder Social home page Coder Social logo

size-label-action's People

Contributors

aslafy-z avatar caarlos0 avatar danielmschmidt avatar davidparsson avatar dione-kist-jemmic avatar fty4 avatar jmnote avatar mat3e avatar mrchief avatar msonowal avatar pascalgn avatar rafaelmagu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

size-label-action's Issues

Custom size shows error

on:
  pull_request
jobs:
  size-label:
    runs-on: ubuntu-latest
    steps:
      - name: size-label
        uses: "pascalgn/[email protected]"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        with:
          sizes: >
            {
              "0": "XS",
              "10": "S",
              "30": "M",
              "100": "L",
              "250": "XL",
              "500": "XXL"
            }

adding this gives this error
Warning: Unexpected input(s) 'sizes', valid inputs are ['']

Resource not accessible by integration - Pull request opened by dependabot

Hello, I'm running this action on a private internal repository, for a enterprise account, and I'm getting this output when the pull request was opened by dependabot

image

When a real user opens the PR, the action runs sucessfully, is there anything that we can do to allow this action run on this scenario ?

Convert to pure JavaScript Action?

Hi, and thanks for the action!

Is there any specific reason for this not being a pure JavaScript action? They're faster, and implementing that seems rather simple.

Multiple github checks created

If a PR event is sent, is it possible to re-use the first check? instead of creating new checks? Note the "assign size labels" checks:

Selection_999(1130)

Cancels action when deleting branch

When I merge a PR successfully, and then delete the branch which the PR was merged from, the size label action runs again. However, it alwys fails, resulting in a failed check after the PR has merged successfully. It's not fatal but it destroys the PR history of successful checks.

### CANCELLED assign size labels 14:35:26Z

Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
169185f82c45: Pulling fs layer
0ccde4b6b241: Pulling fs layer
d0372f57daa2: Pulling fs layer
165911d108d6: Pulling fs layer
54996bce1de5: Pulling fs layer
165911d108d6: Waiting
54996bce1de5: Waiting
169185f82c45: Verifying Checksum
169185f82c45: Download complete
d0372f57daa2: Verifying Checksum
d0372f57daa2: Download complete
0ccde4b6b241: Verifying Checksum
0ccde4b6b241: Download complete
54996bce1de5: Verifying Checksum
54996bce1de5: Download complete
165911d108d6: Verifying Checksum
165911d108d6: Download complete
169185f82c45: Pull complete
0ccde4b6b241: Pull complete
d0372f57daa2: Pull complete
165911d108d6: Pull complete
54996bce1de5: Pull complete
Digest: sha256:c9bb432ec5ec08ee08b040a9fccacebbbf8a91444dac4721600cf5dca9dae57e
Status: Downloaded newer image for gcr.io/github-actions-images/action-runner:latest
e1d15c83907c79250b9835f874517f7978e0dc88e0b97f250dd877c2b304f473: Pulling from gct-12-31z7i2ekvasojsdcoax56id/ce30ef9e153af8851e964b872099a731d968b5cd4642ad5077c457b327fdc6a7/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
8e402f1a9c57: Already exists
5e2195587d10: Already exists
6f595b2fc66d: Already exists
aced7a3c9841: Pulling fs layer
5272366de62a: Pulling fs layer
5272366de62a: Verifying Checksum
5272366de62a: Download complete
aced7a3c9841: Verifying Checksum
aced7a3c9841: Download complete
aced7a3c9841: Pull complete
5272366de62a: Pull complete
Digest: sha256:0880c2755d4803807f2aba6469732d71fc9145ad63f6b9f3a5adffe00e885a58
Status: Downloaded newer image for gcr.io/gct-12-31z7i2ekvasojsdcoax56id/ce30ef9e153af8851e964b872099a731d968b5cd4642ad5077c457b327fdc6a7/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:e1d15c83907c79250b9835f874517f7978e0dc88e0b97f250dd877c2b304f473
Step 1/8 : FROM node:11-alpine
11-alpine: Pulling from library/node
Digest: sha256:6da4878fc63b98ef5fde771b1f05fec9c796e49d249816fe8d544f336ae89d80
Status: Downloaded newer image for node:11-alpine
 ---> a13f3a3ed57f
Step 2/8 : LABEL "com.github.actions.name"="Assign size label"
 ---> Using cache
 ---> 281b6597cc4d
Step 3/8 : LABEL "com.github.actions.description"="Assign labels based on pull request change sizes"
 ---> Using cache
 ---> 5ad6fcb31694
Step 4/8 : LABEL "com.github.actions.icon"="tag"
 ---> Using cache
 ---> f05d6a04d929
Step 5/8 : LABEL "com.github.actions.color"="blue"
 ---> Using cache
 ---> f98293a6fda5
Step 6/8 : COPY . /tmp/src/
 ---> Using cache
 ---> 0fead6349386
Step 7/8 : RUN yarn global add "file:/tmp/src" && rm -rf /tmp/src
 ---> Using cache
 ---> c6b0a613ae93
Step 8/8 : ENTRYPOINT [ "size-label-action" ]
 ---> Using cache
 ---> cccd89b20616
Successfully built cccd89b20616
Successfully tagged gcr.io/gct-12-31z7i2ekvasojsdcoax56id/ce30ef9e153af8851e964b872099a731d968b5cd4642ad5077c457b327fdc6a7/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:e1d15c83907c79250b9835f874517f7978e0dc88e0b97f250dd877c2b304f473

Selection_999(1147)

shows as failed in a merged PR:

Uploading Selection_999(1148).jpg…

Maybe this is also a github actions bug?

Add support for HTTPS proxy

For the unlucky teams in a corporate environment, where all API requests have to go through a HTTPS proxy, with the action run on self-hosted runners, unfortunately this action does not work as it does not support a proxy agent.

It would great to add HTTPS proxy support to solve for this use case.

does not add labels on reopening

This is an issue for us as we use an automation to create PRs. In order for the CI to run we use another automation to close and re-open the PR (actions workaround for triggering CI when a bot creates PRs).

Net result is that we get no size labels.

Why skip if it is re-opened? Seems there would be no harm in simply allowing this to run.

It is possible to close a PR, push changes to the branch and reopen, this will result in no size change either?

Can this be removed or make the options configurable?

Resource not accessible by integration

"Resource not accessible by integration"
cannot POST label - 403 Forbidden

Here's my workflow file size-label.yml

name: size-label
on: pull_request
permissions: write-all
jobs:
  size-label:
    runs-on: ubuntu-latest
    steps:
    - name: size-label
      uses: "pascalgn/[email protected]"
      env:
        GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

job log => 403 Forbidden

▶ Run pascalgn/[email protected]
Changed lines: 7
Matching label: size/XS
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/pascalgn/size-label-action/v0.4.3/dist/index.js:2[5](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:6)82:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async main (/home/runner/work/_actions/pascalgn/size-label-action/v0.4.3/dist/index.js:97:5) {
  status: 403,
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Wed, 11 Jan 2023 0[6](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:7):52:10 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-api-version-selected': '2022-11-28',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': 'A002:6984:386[7](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:8)4C[8](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:9):735FECC:63BE5C[9](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:10)9',
    'x-ratelimit-limit': '[10](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:11)00',
    'x-ratelimit-remaining': '993',
    'x-ratelimit-reset': '1673423444',
    'x-ratelimit-resource': 'core',
    'x-ratelimit-used': '7',
    'x-xss-protection': '0'
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/kuoss/goproject1/issues/9/labels',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'pascalgn/size-label-action octokit-rest.js/18.5.5 octokit-core.js/3.4.0 Node.js/[12](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:13).[22](https://github.com/kuoss/goproject1/actions/runs/3890402527/jobs/6639487264#step:2:23).7 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"labels":["size/XS"]}',
    request: { hook: [Function: bound bound register] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/issues#add-labels-to-an-issue'
}

Not working for PRs with branches from forks

Thanks for this great Action!

I recently added it to https://github.com/fastlane/fastlane/. Unfortunately it seems it only works with PRs for branches of the same repository, not for the many PRs from third party forks and their branches.

Am I doing something wrong or is this expected?

https://github.com/fastlane/fastlane/blob/master/.github/workflows/size-label.yml

https://github.com/fastlane/fastlane/actions?query=workflow%3Asize-label
fastlane/fastlane#16070

Node.js 16 is deprecated

The action is using node 16 deprecated version. I create the #46 to upgrade to node 20 and solve issue below:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: pascalgn/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Pre-defined size of PRs

The current definition of sizes are as

const sizes = {
  0: "XS",
  10: "S",
  30: "M",
  100: "L",
  500: "XL",
  1000: "XXL"
};

However it's possible to define SIZES in yaml file and then parse them from process.env.SIZES. Would be nice to have this feature. Thank you.

Error when label already assigned

GitHub Action Log

Run 397e38b
env:
GITHUB_TOKEN: ***
/usr/bin/docker run --name fe0f2f6c3a91b2354cafba2df5a164264900_0aec39 --label 29fe0f --workdir /github/workspace --rm -e GITHUB_TOKEN -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -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/sos/sos":"/github/workspace" 29fe0f:2f6c3a91b2354cafba2df5a164264900
Changed lines: 19
Matching label: size/S
Correct label already assigned
##[error]Docker run failed with exit code 78

Cannot read property 'substr' of undefined

I was creating a PR as usualy and then this happened:

Step 8/8 : ENTRYPOINT [ "size-label-action" ]
 ---> Using cache
 ---> db0b7ef7ec4a
Successfully built db0b7ef7ec4a
Successfully tagged gcr.io/gct-12-31z7i2ekvasojsdcoax56id/ce30ef9e153af8851e964b872099a731d968b5cd4642ad5077c457b327fdc6a7/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:e1d15c83907c79250b9835f874517f7978e0dc88e0b97f250dd877c2b304f473
Already have image (with digest): gcr.io/github-actions-images/action-runner:latest
TypeError: Cannot read property 'substr' of undefined
    at isIgnored (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:121:27)
    at Diff.parsePatch.flatMap.file (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:152:7)
    at Array.flatMap (<anonymous>)
    at getChangedLines (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:151:6)
    at main (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:70:24)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

### FAILED assign size labels 16:40:45Z (10.521s)

Possibility to ignore commits

It would be nice to be able to ignore commits based on a pattern that matches the commit message, to exclude automatic reformatting of files from size calculation. Useful when files are automatically reformatted and committed separately so they can be skipped over during review.

Consider the option to ommit deleted files count

In my project, there is a strict rule about the size of PR, Which if it's bigger then XXL, it won't have PR's approval,
Practically, some of the big files deletion (refactoring) is counted in the labeling action which is a bit unfair to be counted while no body care about the deleted files much, or just 2 seconds for reviewing (means they should not be considered in review effort)
Is it make sense to have option to not consider file deletion count ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.