wei/pull

feat: ability to lint branches other then master

Sou1Aced opened this issue ยท 7 comments

Currently, the validator for wei/pull (https://pull.git.ci/check/${owner}/${repo})only checks the master branch of the repository, but lists "no file found" if it is added in a branch other then master. This causes a problem of not being able to test/validate the .yml before merging.

Adding this would allow the ability to validate the pull.yml file before merging with the master file, allowing for testing before hand.

wei commented

Thanks @Sou1Aced for the feedback. I have created a runkit endpoint that can validate any file against pull's joi schema:

https://pull-validation-uxx737qt0sl1.runkit.sh/?url=<raw file url>

e.g. https://pull-validation-uxx737qt0sl1.runkit.sh/?url=https://raw.githubusercontent.com/wei/pull/master/.github/pull.yml

Make sure you url encode the <raw file url> parameter if it contains a query string (seen in private repo raw links).

Thanks @wei! I was looking for a solution to this, too.

Thanks @Sou1Aced for the feedback. I have created a runkit endpoint that can validate any file against pull's joi schema:

https://pull-validation-uxx737qt0sl1.runkit.sh/?url=<raw file url>

e.g. https://pull-validation-uxx737qt0sl1.runkit.sh/?url=https://raw.githubusercontent.com/wei/pull/master/.github/pull.yml

Make sure you url encode the <raw file url> parameter if it contains a query string (seen in private repo raw links).

Is this still accurate for private repos? Response timed out when I fed it the raw URL to my pull.yml; it doesn't contain any querystrings.

FWIW this is everything it contains:

version: "1"

rules:
  - base: main
    upstream: rajnandan1:main
    mergeMethod: hardreset  # Optional, one of [none, merge, squash, rebase, hardreset], Default: none.
    mergeUnstable: false    # Optional, merge pull request even when the mergeable_state is not clean. Default: false

label: ":arrow_heading_down: pull"  # Optional
conflictLabel: "merge-conflict"     # Optional, on merge conflict assign a custom label, Default: merge-conflict
wei commented

@pythoninthegrass Runkit won't have permission to load the yml from private repos. You could host the file somewhere else (like a gist) to check.

I'll give it a shot. Thanks!

Think it's working with public gists! This URL is what I got for another pull.yml.

The json response is

{
  "version": "1",
  "rules": [
    {
      "base": "main",
      "upstream": "somet-code:main",
      "mergeMethod": "hardreset",
      "mergeUnstable": false,
      "assignees": [],
      "reviewers": [],
      "conflictReviewers": []
    }
  ],
  "label": ":arrow_heading_down: pull",
  "conflictLabel": "merge-conflict"
}

which appears to have validated as expected. Tested against another purposely malformed gist and got

ValidationError: "rules[0].base" is required

Hi @wei thank you for this! Can you please check if the runkit endpoint is still online? I'm trying the same URL posted by @pythoninthegrass but I am getting a timeout (The server did not return a response quickly enough).