Skip to content

Add api_url as input #135

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

Merged
merged 1 commit into from
Jul 3, 2025
Merged

Add api_url as input #135

merged 1 commit into from
Jul 3, 2025

Conversation

ncalteen
Copy link
Contributor

@ncalteen ncalteen commented Jul 3, 2025

This pull request introduces support for custom GitHub API URLs in the issue-ops-validator project. The most significant changes include updates to the authentication mechanism, new input handling for the api_url parameter, and test adjustments to validate the new functionality.

@ncalteen ncalteen self-assigned this Jul 3, 2025
@Copilot Copilot AI review requested due to automatic review settings July 3, 2025 14:28
@ncalteen ncalteen requested a review from a team as a code owner July 3, 2025 14:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for a custom GitHub API URL for all Octokit calls in the issue-ops-validator action.

  • Introduces an api_url input and reads it in main.ts, comments.ts, and team.js.
  • Passes the api_url value as baseUrl when instantiating Octokit.
  • Updates tests to mock the new input and documents it in action.yml and README.md.

Reviewed Changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main.ts Read api_url input and supply it to new Octokit({ baseUrl })
src/comments.ts Configure getOctokit with the custom api_url
action.yml Define api_url input with default and (optional) configuration
tests/main.test.ts Mock api_url alongside existing inputs
tests/comments.test.ts Reset and mock api_url for comment retrieval tests
README.md Add documentation for the new api_url parameter
.github/validator/team.js Pass api_url into Octokit instantiation in team validator
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (5)

src/main.ts:20

  • The api_url input is marked as required in code but action.yml defines it as optional with a default. Consider setting required: false here so users aren’t forced to provide it manually.
  const apiUrl: string = core.getInput('api_url', { required: true })

src/main.ts:20

  • [nitpick] The input name api_url uses an underscore while other inputs use hyphens (e.g., add-comment). Renaming to api-url will keep naming consistent across your action.
  const apiUrl: string = core.getInput('api_url', { required: true })

src/comments.ts:19

  • This call still uses required: true for api_url even though the action declares it as optional. Change to required: false to match the default behavior in action.yml.
    baseUrl: core.getInput('api_url', { required: true })

.github/validator/team.js:42

  • Similarly, this marks api_url as required in your validator. It should be optional to align with the action’s default handling.
    baseUrl: core.getInput('api_url', { required: true })

tests/main.test.ts:74

  • [nitpick] Consider adding assertions in this test to verify that Octokit is instantiated with the baseUrl option set from api_url, ensuring the new behavior is actually covered.
      .mockReturnValueOnce('https://api.github.com') // api_url

Copy link

github-actions bot commented Jul 3, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.03s
✅ JSON jsonlint 11 0 0 0.19s
✅ JSON npm-package-json-lint yes no no 0.73s
✅ JSON prettier 11 0 0 0.95s
✅ JSON v8r 11 0 0 9.7s
✅ MARKDOWN markdownlint 1 0 0 0.97s
✅ MARKDOWN markdown-link-check 4 0 0 4.74s
✅ REPOSITORY checkov yes no no 18.15s
✅ REPOSITORY gitleaks yes no no 1.39s
✅ REPOSITORY git_diff yes no no 0.03s
✅ REPOSITORY grype yes no no 33.34s
✅ REPOSITORY secretlint yes no no 1.23s
✅ REPOSITORY syft yes no no 4.61s
✅ REPOSITORY trivy-sbom yes no no 1.87s
✅ REPOSITORY trufflehog yes no no 17.35s
✅ TYPESCRIPT prettier 30 0 0 1.78s
✅ YAML prettier 18 0 0 0.64s
✅ YAML v8r 18 0 0 6.21s
✅ YAML yamllint 18 0 0 0.46s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen merged commit 67329c9 into main Jul 3, 2025
5 checks passed
@ncalteen ncalteen deleted the ncalteen/api-url branch July 3, 2025 15:46
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