Code Monkey home page Code Monkey logo

Comments (10)

hackebrot avatar hackebrot commented on September 14, 2024 2

Yes! I love that idea! 😃 :octocat:

from labels.

mariatta-bot avatar mariatta-bot commented on September 14, 2024 1

🤖 Mariatta was mentioned, but she's out of open source until end of September 2019. Hopefully someone else can look into this in the meantime.

from labels.

michaeljoseph avatar michaeljoseph commented on September 14, 2024

👋 @Mariatta
I'm curious about how the app would work? What events would it be responding to?

from labels.

hackebrot avatar hackebrot commented on September 14, 2024

Hi @michaeljoseph! 👋

Mariatta and I chatted about how the GitHub app would work offline and we came up with the following design. 📝

Adding the app

When the app is added to a GitHub repo it will check for a labels file on the repo's default branch.

  • If it can't find one it will use fetch to create one based on the repo's GitHub labels and commit the file on the repo's default branch.
  • If it can find one it will use fetch to update it based on the repo's GitHub labels and commit the changed file to the repo's default branch.

GitHub label event

When a user modifies a GitHub label of a repo, the labels app will react to event and use fetch to update the labels file and commit the changed file to the repo's default branch.

GitHub push event

When a users pushes commits to the repo's default branch, the labels app will react to the event and check whether the commit modifies the labels file.

If the file was modified, the labels app will use sync to update the repo's GitHub labels and commit the changed labels file (sync updates the labels file, so that TOML section names match the name parameter).

GitHub pull request event

When a new pull-request is created, the labels app will react to the event and check whether it modifies the labels file.

If the file was modified, the labels app use sync with the dryrun option and comment on the pull-request how merging the pull-request would change the repo's GitHub labels.


I think it would be really cool if we could implement this idea as a GitHub Action! 🤖

I'm curious to hear what you think about our design!

from labels.

hackebrot avatar hackebrot commented on September 14, 2024

Other use cases

(notes from @Mariatta and my chat at PyCon DE)

  • import from another repository
  • export to other repositories
  • keep labels in sync across repositories in org (select labels)

from labels.

mariatta-bot avatar mariatta-bot commented on September 14, 2024

🤖 Mariatta was mentioned, but she's out of open source until end of September 2019. Hopefully someone else can look into this in the meantime.

from labels.

hackebrot avatar hackebrot commented on September 14, 2024

What do you think @michaeljoseph? 😃

from labels.

jean avatar jean commented on September 14, 2024

I just noticed that there is a GitHub Action based on labels: https://github.com/marketplace/actions/manage-issue-labels
It looks like it allows defining a master repo that pushes out labels to multiple other repos, but I couldn't figure out exactly how that works yet.

from labels.

tprasadtp avatar tprasadtp commented on September 14, 2024

@jean I created it. You can define labels in .github/labels.toml(default) and use it as

on:
  push:
    branches:
      - master
name: labels
jobs:
  labels:
    name: labels
    runs-on: ubuntu-latest
    steps:
    - name: sync labels
      uses: tprasadtp/labels@master # Prefer using a tagged version!!!
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

It will sync the labels, for the repo in which actions is being executed. To manage labels for multiple repos in a single workflow, you have to use builds matrix and a Personal Access Token.

jobs:
  labels:
    name: labels
    runs-on: ubuntu-latest
     strategy:
      fail-fast: false
      matrix:
        repo: [ "repo1", "repo2", "repo3", "repo4"]
    steps:
    - uses: actions/checkout@v2
    - name: sync labels
      uses: tprasadtp/labels@master # Prefer using a tagged version!!!
      with:
        file: .github/labels.toml
        repo: ${{ matrix.repo }}
        token: ${{ secrets.PAT }}

Note: It only works on x86_64 and Linux.

from labels.

browniebroke avatar browniebroke commented on September 14, 2024

I've setup a GitHub action in my projects to run labels on push to main, when the changes look relevant. I'm pretty sure I copied it from somewhere else a while back, but I can't remember where...

name: Sync Github labels

on:
  push:
    branches:
      - main
    paths:
      - ".github/**"

jobs:
  labels:
    runs-on: ubuntu-latest

    permissions:
      issues: write

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.x
      - name: Install labels
        run: pip install labels
      - name: Sync config with Github
        run: labels -u ${{ github.repository_owner }} -t ${{ secrets.GITHUB_TOKEN }} sync -f .github/labels.toml

I recently managed to tweak it with the right permissions, so it works with the native GITHUB_TOKEN, scoped to give write access to the issues.

I've put together pull request #36 to simplify the user-land setup a bit and document its usage.

Suggestions welcome!

from labels.

Related Issues (19)

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.