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

Allow github context in configValidator and overrideValidator #584

Merged
merged 8 commits into from
Feb 5, 2024

Conversation

sshrestha02
Copy link
Contributor

@sshrestha02 sshrestha02 commented Feb 1, 2024

  • Added new property (github) in MergeDeep Constructor
  • Added github context as argument whenever isValid and canOverride functions are invoked
  • Added 'githubContext' as a new parameter whenever a new function is created

We also tested our changes to see if githubContext was available to use via deployment-settings.yaml :

restrictedRepos:
  # You can exclude certain repos from safe-settings processing
  #  If no file is specified, then the following repositories - 'admin', '.github', 'safe-settings' are exempted by default
  exclude: ['^admin$', '^\.github$', '^safe-settings$', '.*-test']
  # # Alternatively you can only include certain repos
  # include: ['^test$']
configvalidators:
  - plugin: repository
    error: |
      `Repository plugin errored`
    script: |
      githubContext.request('/repos/{owner}/{repo}', { owner: 'cdot-dev' , repo: 'dauxs-cdot-demo' }).then(res => { console.log(res.data) })

      if (new RegExp(baseconfig.validator.pattern).test(baseconfig.name)){
        console.log(`${baseconfig.name} matches ${baseconfig.validator.pattern}`)
      }
      return true

and we were able to successfully get a response back.

Edit: Fixed mergeDeep.test.js (mock function returns an anonymous function)

@sshrestha02 sshrestha02 changed the title init Allow github context in configValidator and overrideValidator Feb 1, 2024
package-lock.json Outdated Show resolved Hide resolved
app.yml Outdated Show resolved Hide resolved
@decyjphr decyjphr merged commit 6c297f2 into github:main-enterprise Feb 5, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants