micnncim / action-label-syncer

GitHub Action to sync GitHub labels in the declarative way
https://github.com/marketplace/actions/label-syncer
Apache License 2.0
197 stars 31 forks source link

Sync labels on multiple repositories at once #49

Closed slawekjaranowski closed 3 years ago

slawekjaranowski commented 4 years ago

In many case I want to sync labels on multiple repositories. No I can set repository for action, but only one.

My proposition to support syntax like:

- uses: micnncim/action-label-syncer@v1
        with:
          repository: |
              myother/repository,
              myother/second-repository;
              myother/next-repository

we can split repositories name by new line, comma, semicolon

micnncim commented 4 years ago

Could you try to use matrix? See also: https://github.com/micnncim/action-label-syncer/issues/45

slawekjaranowski commented 4 years ago

ok, matrix can be some workaround until we reach limits for github action: https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#usage-limits It also be cheaper when someone will use in private repo - one job consume less minute.

In my opinion support multiple repos by action will be more effective we will need one job for work.

So implementation it is not difficult - I can prepare next PR, but I need my previous PR.

slawekjaranowski commented 4 years ago

Example configuration with matrix:

jobs:
  labels_sync:
    strategy:
      # don't break another job if one is failed
      fail-fast: false
      matrix:
        repo:
          - user/repo1
          - user/repo2
          - user/repo3

    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.3

      - name: Sync
        uses: micnncim/action-label-syncer@v1.2.0
        with:
          repository: ${{ matrix.repo }}
          token: ${{ secrets.TOKEN }}
          prune: false
davidxjohnson commented 3 years ago

One of the reasons for wanting a multi-repo sync is if the repos all share a project board. This makes the shared project board more consistent with its use of standardized labels. As you probably know, the labels belong to the repo, not the project.

The matrix approach is compelling, other than the draw-back of kicking off a potentially large number of jobs.

The code does not appear to support multiple repos; just one repo. The fix would be pretty simple with some minor mods to main.go to accept a list of 1 or more repos.

If nobody else is working on that, I'd be happy to submit a pull-request.

micnncim commented 3 years ago

Sorry for being late :bow: I've added the support of multiple repositories and released v1.3.0. It's also available with v1.

jdbruijn commented 1 year ago

Does anybody actually have this working? I have the following configuration but only repo-a is being processed.

- name: Synchronise GitHub labels
  uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
  with:
    manifest: .github/labels.yml
    prune: false
    token: ${{ steps.generate_token.outputs.token }}
    repository: |
        me/repo-a
        me/repo-b
jdbruijn commented 1 year ago

My bad, actually works but the token didn't have the appropriate permissions and I didn't see that because of #62. Multiple repositories from input now works as expected!