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

Can this reference the PR template? #1

Open
john-science opened this issue Feb 16, 2023 · 2 comments
Open

Can this reference the PR template? #1

john-science opened this issue Feb 16, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@john-science
Copy link

john-science commented Feb 16, 2023

As @opotowsky and I were just lamenting, your wonderful GH Action turns out to be inflexible for our repo because we have a lengthy checklist in our PR template. So, any time someone changed the text in that template (which happens regularly), they would need to know to update the "minLength" field in your Action.

Is it POSSIBLE to find the text of the PR template in this Action, and pull the number of characters from it?

  1. If so, could we add that as a feature to this repo?
  2. If you'd rather NOT, could you point me in the right direction, so I could make a fork of your Plugin for our little, bespoke desires?
@john-science
Copy link
Author

john-science commented Feb 16, 2023

Sorry, I've never looked at GH Actions plugins before, but based on this page, I'm trying to decide if we could find the PR template in TypeScript in a similar way to your getPullRequestDescription() method, but using something like:

github.workspace + "/.github/pull_request_template.md"

Then I'd need to be able to:

  1. Check if the file exists.
  2. Read it's contents
  3. Return the length of its contents.

It might be doable?

@aeural
Copy link

aeural commented Mar 15, 2023

@john-science I had a work around for this;

    - name: Set Length
      id: get_length
      run: echo ::set-output name=template_length::$(curl <url_to_ pull_request_template.md> | wc -m)

    - name: Enforce Pull Request Description Length
      uses: ryanvade/enforce-pr-description-length-action@v1
      with:
        minLength: ${{steps.get_length.outputs.template_length}}

but it's not working perfectly because the string body of the PR, in the json, counts spaces as multiple characters. you will need to add some fudge factor to template_length

@ryanvade ryanvade moved this to Not Started in @ryanvade's public project Nov 24, 2023
@ryanvade ryanvade added the enhancement New feature or request label Nov 24, 2023
@ryanvade ryanvade self-assigned this Nov 24, 2023
@ryanvade ryanvade added this to the V2 milestone Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Not Started
Development

No branches or pull requests

3 participants