actions-label-commenter icon indicating copy to clipboard operation
actions-label-commenter copied to clipboard

support: load config from external repository

Open alombarte opened this issue 1 year ago • 9 comments

Checklist

  • [X] I am using the latest version of this action.
  • [X] I have read the latest README and followed the instructions.
  • [X] I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.

Describe your question

Hi,

I was testing the action and I got the impression that the configuration file is always assumed to live inside the repository whose job is calling the action. When using the special .github repository (not folder) along with the health files and other cross-organization workflows, the action fails to load the configuration.

For instance, in your github.com/ORGANIZATION/.github repository, you have a file github.com/ORGANIZATION/.github/.github/workflows/label-commenter.yml with content:

name: Label Commenter

on:
  workflow_call:

permissions:
  contents: read
  issues: write
  pull-requests: write

jobs:
  comment:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3

      - name: Label Commenter
        uses: peaceiris/actions-label-commenter@v1

The on specifies the calling from outside. And then you have the config in its default location, also inside the .github repo. Then you call it from another repo (github.com/ORGANIZATION/some-repo) with its workflow:

name: Label commenter
on:
  issues:
    types: [labeled, unlabeled]
  pull_request_target:
    types: [labeled, unlabeled]
jobs:
  stale:
    uses: ORGANIZATION/.github/.github/workflows/label-commenter.yml@main

The configuration file will fail to load as it is looking from within the calling repo, but the config lives centralized with the label commenter action.

Is there a way to specify a different organization and repo to load the configuration file, or to load it embedded using with or similar in one file? Otherwise the configuration file has to be copied in all repos of the organization.

Thank you!

Relevant links

YAML config: https://github.com/krakendio/.github/blob/48caa81a3c9159759f064976665631d6f5e9bb83/.github/label-commenter-config.yml
YAML workflow: https://github.com/krakendio/krakend-schema/blob/1dd2ccfe75bcfb7778a1340f0ef413da93a368ef/.github/workflows/labels.yml

Relevant log output

Action failed with error "not found .github/label-commenter-config.yml"

Additional context.

No response

alombarte avatar Sep 29 '22 21:09 alombarte