Skip to content

Handle repositories input with spaces between repositories #106

Closed

Description

@niodice

This action could handle a little more flexibility in the repositories input. A common mistake is to provide repositories: foo, bar instead of repositories: foo,bar if a token is needed for > 1 repository.

For example:

    - name: Generate Github Actions App token
      id: generate-token
      uses: actions/create-github-app-token@v1
      with:
        app-id: ${{ env.GH_APP_APP_ID }}
        private-key: ${{ env.GH_APP_PRIVATE_KEY }}
        repositories: foo, bar

Fails to get a token because the body in the HTTP request to GH will look like this:

body: '{"repositories":["foo"," bar"]}',

I think trimming the repos, something like repos = repos.map(r => r.trim()), would catch this and make for a more intuitive API

Activity

  1. gr2m commented on Feb 27, 2024

    @gr2m
    Contributor

    Yes, we should definitely do that. Pull request welcome! Please add a test or update one of the existing ones 🙏

  2. krokofant commented on Jun 3, 2024

    @krokofant

    Should trailing commas be trimmed as well? Seems these lines needs to be changed

    repo: parsedRepositoryNames.split(",")[0],

    repositoryNames: parsedRepositoryNames.split(","),

    For just spaces

    'a, b,c , d'.split(/\s*,\s*/)
    

    With trailing commas:

    'a, b,c , d,'.replace(/,\s*$/,'').split(/\s*,\s*/)
    
  3. create-app-token-action-releaser commented on Sep 11, 2024

    @create-app-token-action-releaser
    Contributor

    🎉 This issue has been resolved in version 1.11.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions