Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure using the with parameter #11

Open
TimonVS opened this issue Sep 25, 2019 · 7 comments
Open

Configure using the with parameter #11

TimonVS opened this issue Sep 25, 2019 · 7 comments

Comments

@TimonVS
Copy link
Owner

TimonVS commented Sep 25, 2019

Configuration should be done using the with parameter instead of having to create a separate YAML file. We can still keep support for the YAML file as not to cause breaking changes for people who use the master version of this Action, or we could create a ticket in the repo to give users a heads up.

@amacado
Copy link
Contributor

amacado commented Sep 25, 2019

Maybe you could make an example, i'm not sure if I understand what u mean

@TimonVS
Copy link
Owner Author

TimonVS commented Sep 25, 2019

name: PR Labeler
on:
  pull_request:
    types: [opened]

jobs:
  pr-labeler:
    runs-on: ubuntu-latest
    steps:
      - uses: TimonVS/pr-labeler-action@master
        with:
          feature: ['feature/*', 'feat/*']
          fix: fix/*
          chore: chore/*
          fixed-branch: fixed-branch-name
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

In the above example each parameter provided to the with parameter will be exposed as an environment variable prefixed with INPUT_ (see https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith). So we can filter process.env to only include environment variables that are prefixed with INPUT_ and we have our config. The only downside is that an environment variable is always a string. So the array in the above example has to be evalled and another list syntax won't work. The huge benefit is that configuration can be done right within the workflow instead of having to create a separate YAML file.

@amacado
Copy link
Contributor

amacado commented Sep 25, 2019

I see what u mean. I like the idea but would keep the option to have a separated config file like we at the moment. So making both a choice and not limiting to one case.
We should also add an option to specifiy the path of the pr-labeler.yml configuration file. Maybe a new issue for that?

@TimonVS
Copy link
Owner Author

TimonVS commented Sep 25, 2019

I like the idea but would keep the option to have a separated config file like we at the moment. So making both a choice and not limiting to one case.

Agreed, we'll keep that.

We should also add an option to specifiy the path of the pr-labeler.yml configuration file. Maybe a new issue for that?

Good idea, feel free to file an issue.

@asbjornu
Copy link

GITHUB_TOKEN can also preferably be passed in the with section, so env can be removed completely.

@tophercf
Copy link

++ to this optional config @TimonVS . The main value add is i would be able to use this within a workflow that is re-usable. Re-useable workflows do not support pulling in additional files outside of the called/referenced workflow at the moment, in this case the external config file.

@TimonVS
Copy link
Owner Author

TimonVS commented Jun 29, 2022

@tophercf I may be misunderstanding, but would it work if you add "\.github\/pr-labeler\.yml" to filePatterns in your workflow template (see step 4: https://docs.github.com/en/actions/using-workflows/creating-starter-workflows-for-your-organization)? I haven't used this feature before, so I don't know for sure if this would work. I'm still in favor of adding this feature, but I need to find some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants