GithubHelp home page GithubHelp logo

puppetlabs / community-labeller Goto Github PK

View Code? Open in Web Editor NEW
1.0 32.0 0.0 1.01 MB

A GitHub action to label issues and pull requests with a community label

License: MIT License

JavaScript 1.70% TypeScript 98.30%

community-labeller's Introduction

community-labeller

This is a basic action that will label issues and pull request with a given label if the contributor is not a member of a given list of organisations.

Inputs

name required description default
label_name false The name of the label. community
label_color false The color of the label. If the label already exists in the repository, this setting will have no effect. 5319E7
org_membership false Contributions from users that are not members of the specified organisations will be labeled with the configured label. The value can be a single organisation or a comma-separated list of organisations. puppetlabs
logins_to_ignore false Contributions from the specified users will not be labeled by this action. The value can be a single login or a comma-separated list of logins. N/A
fail_if_member false Pipeline will fail, if the user is member of specified organisations and no label has been added manually. false
token true A token with enough privilege to view org memberships and repo content. N/A

Security

Scopes

This action requires a token with read:org. The standard GITHUB_TOKEN will not work.

Workflow events

The labeller needs to access the secret associated with the repository. To enable this safely for both internal and external contributors, we reccoment using the pull_request_target event for pull requests.

Usage

name: community-labeller

on:
  issues:
    types:
      - opened
  pull_request_target:
    types:
      - opened

jobs:
  label:
    runs-on: ubuntu-latest
    steps:

      - uses: puppetlabs/community-labeller@v0
        name: Label issues or pull requests
        with:
          label_name: community
          label_color: '5319e7'
          org_membership: puppetlabs
          token: ${{ secrets.CUSTOM_TOKEN }}

Contributing

This action has been developed with node v16.

# Install the dependencies
npm install

# Run tslint
npm lint

## Run tests
npm test

Releasing

To create a realease you can run the following commands ensuring that you are on main:

npm version "v1.0.0"
git push --follow-tags

Once the release has been created you will need to publish it by following the instructions provided by GitHub.

community-labeller's People

Contributors

chelnak avatar dependabot[bot] avatar david22swan avatar jelinwils avatar malikparvez avatar livinginsyn avatar petergmurphy avatar

Stargazers

 avatar

Watchers

 avatar Reid Vandewiele avatar Greg Sparks avatar Tobi Lehman avatar Alex Dreyer avatar Filip Hrbek avatar Chris Roddy avatar James Cloos avatar  avatar Paul Riley avatar Joe Wagner avatar Edwin Maldonado avatar Garrett Rowell avatar Neil Anderson avatar Keith Apps avatar  avatar  avatar  avatar Rajesh Radhakrishnan avatar Matthew Stone avatar  avatar  avatar Cody Clements avatar  avatar  avatar Dan Walsh avatar Nick Burgan avatar Gillian Weisgram avatar Paul Reed avatar Tzvika Shahaf avatar danadoherty avatar  avatar

community-labeller's Issues

TEST

Describe the Bug

A clear and concise description of what the bug is.

Expected Behavior

A clear and concise description of what you expected to happen.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'

Environment

  • Version [e.g. 1.27.0]
  • Platform [e.g. Ubuntu 18.04]

Additional Context

Add any other context about the problem here.

Labeller failing when triggered from a fork

Describe the Bug

When the labeller is triggered from a fork, the workflow does not have access to the secrets for the repo and therefore fails.

Expected Behavior

The workflow should execute successfully.

Steps to Reproduce

Create a fork and open a PR in to a module repository.

Environment

  • GHA

Additional Context

It looks like GitHub have addressed this by adding a new event called pull_request_target.

[pull_request_target] behaves in an almost identical way to the pull_request event with the same set of filters and payload. However, instead of running against the workflow and code from the merge commit, the event runs against the workflow and code from the base of the pull request. This means the workflow is running from a trusted source and is given access to a read/write token as well as secrets enabling the maintainer to safely comment on or label a pull request.

test2

Use Case

A clear and concise description of what the problem you're trying to solve is. Ex. I'm always frustrated when [...]

Describe the Solution You Would Like

A clear and concise description of what you want to happen.

Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request here.

test

Use Case

A clear and concise description of what the problem you're trying to solve is. Ex. I'm always frustrated when [...]

Describe the Solution You Would Like

A clear and concise description of what you want to happen.

Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request here.

test

Describe the Bug

A clear and concise description of what the bug is.

Expected Behavior

A clear and concise description of what you expected to happen.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'

Environment

  • Version [e.g. 1.27.0]
  • Platform [e.g. Ubuntu 18.04]

Additional Context

Add any other context about the problem here.

Internal contributions are labelled as community

Describe the Bug

When a contribution is made the labeler checks the org membership of the user. If the user is NOT a member of the puppet org, or another that is specified in config, a community label should be added to the contribution.

This is currently not happening.

Expected Behavior

Contributions should be labelled appropriately.

Things to check:

  • can the issue be replicated locally?
  • Are there situations where it does work as expected in actions? E.g when a user has org membership set to public vs private?
  • have the org permissions of the token changed?
  • Did the recent code update cause some sort of regression?

test

Use Case

A clear and concise description of what the problem you're trying to solve is. Ex. I'm always frustrated when [...]

Describe the Solution You Would Like

A clear and concise description of what you want to happen.

Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request here.

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.