GithubHelp home page GithubHelp logo

atsign-company / labels Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 1.0 150 KB

Repo to push a standard set of labels to the other repos we use so that we have consistent labeling

License: Mozilla Public License 2.0

Python 100.00%
github automation labels python3 hacktoberfest

labels's Introduction

labels

Repo to push a standard set of labels to the other repos we use so that we have consistent labeling.

LICENSE:

Mozilla Public License Version 2.0 see FAQ for more detail.

Contributions:

If you find a bug then please raise an issue.

We'd also love to get pull requests for improvements.

Please see CONTRIBUTING.md for details.

Our code of conduct is based on Contributor Covenant

Automation:

There's a GitHub Action Sync configured in this repo that runs unify.py to apply the labels from github-labels.yaml to the repos listed in atsign-foundation.yaml. The action runs every time a change is pushed to this repo (such as an additon to the labels file).

There's also a Newlabel Action that adds runs when new labels are added to this repo, running dump_github_labels.py to create a new github-labels.yaml and then unify.py to sync like above.

The Action uses a Secret called REPO_TOKEN which is a Personal access token scoped for repo from an account with access to the target organisation repos.

Python scripts:

clear_github_labels.py

Used to remove existing labels from a repo:
./clear_github_labels.py user/org_name repo_name

dump_github_labels.py

Dump the labels in an existing repo to a file:
./dump_github_labels.py github-labels.yaml user/org_name repo_name

list_org_repos.py

List the repos in an org to a file:
./list_org_repos.py myorg-repos.yaml org_name

push_github_labels.py

Push a set of labels from a file to a repo:
./push_github_labels.py github-labels.yaml user/org_name repo_name

unify_labels.py

Push a set of labels from a file to a list of repos within an org:
./unify_labels.py github-labels.yaml myorg-repos.yaml org_name

Lists:

atsign-foundation-repos.yaml

Repos in the atsign-foundation org

github-labels.yaml

Labels used across atsign orgs

people-labels.yaml

Test set with additional label

testrun.yaml

Smaller set of repos in atsign-foundation for testing

Acknowledgement:

Thanks to the DXC Online DevOps Dojo team for the github-labels.py script that's used in the Welcome module.

Known issues:

Race condition

When multiple labels are added in quick succession the automation runs may fail when they get to git push because another automation run has changed the repo since it was pulled:

To https://github.com/atsign-company/labels
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/atsign-company/labels'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Process completed with exit code 1.

The code has been refactored to minimise the window for this happening, but it's still possible.

Where there are subsequent successful runs there's no need to do anything. If the most recent run fails in this way then simply rerun it.

Max 100 labels

The dump utility will only dump the first page of labels at its max size of 100.

Todo:

GitHub don't (yet) seem to have a public API to update the label defaults in an org, but once they do it will be useful to sync those too.

Add page checking to dump utility for >100 labels.

labels's People

Contributors

github-actions[bot] avatar cpswan avatar dependabot[bot] avatar ksanty avatar xavierchanth avatar gkc avatar tylertrott avatar mend-for-github-com[bot] avatar

Stargazers

Laurent Douillet avatar Majid Hajian avatar

Watchers

Barbara Tallent avatar  avatar James Cloos avatar Kevin Nickels avatar Colin Constable avatar Sarika avatar

Forkers

topalovtm

labels's Issues

Support > 100 labels

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Work with over 100 labels

Describe alternatives you've considered
Keeping total labels below 100

Additional context
Page limit of API is 100, so that's presently set to max, but the dumper could iterate across multiple pages

Switch from YAML to JSON for export/import

Is your feature request related to a problem? Please describe.
Known issues with : and @ symbols in YAML

Describe the solution you'd like
Label export and import that works for all valid labels

Describe alternatives you've considered
Presently using workarounds like at_ in place of @

Additional context
See multiple failed Actions runs when labels were added starting with @

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.