Skip to content

fix(core/github): edDraftURI opt-out and custom newIssuesURL#5246

Draft
marcoscaceres wants to merge 2 commits intomainfrom
fix/5103-eddrafturi
Draft

fix(core/github): edDraftURI opt-out and custom newIssuesURL#5246
marcoscaceres wants to merge 2 commits intomainfrom
fix/5103-eddrafturi

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

Closes #5103
Closes #4317

Copy link
Copy Markdown
Contributor

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 updates the GitHub integration in ReSpec’s core config normalization so specs can customize the “new issue” destination and aims to support opting out of the GitHub-derived edDraftURI. It also extends the GitHub module’s localized strings and adds/updates tests around the new config behavior.

Changes:

  • Add support for github.newIssuesURL and use it when generating GitHub feedback links.
  • Adjust core/github handling around edDraftURI generation when the config explicitly provides that field.
  • Add GitHub spec tests for edDraftURI opt-out cases and custom newIssuesURL, plus French localization strings in core/github.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/core/github.js Adds French strings, introduces custom newIssuesURL parsing/validation, and changes edDraftURI defaulting logic.
tests/spec/core/github-spec.js Adds tests for explicit edDraftURI values and normalization of custom newIssuesURL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/github.js
Comment on lines +109 to +120
if (
typeof conf.github === "object" &&
conf.github.hasOwnProperty("newIssuesURL")
) {
try {
const url = new URL(String(conf.github.newIssuesURL));
if (url.protocol !== "https:") {
const msg = docLink`${"[github.newIssuesURL]"} must use HTTPS. (${String(conf.github.newIssuesURL)}).`;
rejectGithubPromise(msg);
return;
}
newIssuesURL = url.href;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The HTTPS-only check is intentionally broad. Monorepo scenarios use custom issue URLs at arbitrary paths (e.g., label-filtered queries). Tightening to require /issues/ would break legitimate use cases.

Comment on lines +108 to +123
it("supports custom newIssuesURL", async () => {
const opts = {
config: Object.assign(makeBasicConfig(), {
github: {
repoURL: "https://github.com/speced/respec/",
newIssuesURL: "https://github.com/speced/respec/issues/new",
},
}),
body: makeDefaultBody(),
};
delete opts.config.edDraftURI;
const doc = await makeRSDoc(opts);
const { respecConfig: conf } = doc.defaultView;
expect(conf.github.newIssuesURL).toBe(
"https://github.com/speced/respec/issues/new"
);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added. The test now asserts the rendered feedback link in the DOM uses the custom URL, not just the config value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in ce9b996. The test now adds excludeGithubLinks: false so the links are rendered, then asserts that the "File an issue" <dd> element's <a> href equals the custom newIssuesURL — same pattern as the existing pullsURL/commitHistoryURL monorepo test.

Comment thread src/core/github.js
Comment on lines +204 to +205
if (!conf.hasOwnProperty("edDraftURI")) {
newProps.edDraftURI = `https://${org.toLowerCase()}.github.io/${repo}/`;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The opt-out IS implemented. The hasOwnProperty("edDraftURI") check at the bottom of the diff:

if (!conf.hasOwnProperty("edDraftURI")) {
  newProps.edDraftURI = `https://${org}.github.io/${repo}/`;
}

Only auto-generates edDraftURI when the author hasn't set it. If they set edDraftURI: null or edDraftURI: "", hasOwnProperty is true and the auto-generation is skipped. Two new tests verify both paths.

@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

… link

Agent-Logs-Url: https://github.com/speced/respec/sessions/20f04c30-6520-406b-b673-555dabf64b8b

Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

All three reviewer concerns have been addressed:

  1. HTTPS-only check on newIssuesURL (comment on lines 109-120): No change needed — the intentionally broad HTTPS check is correct for monorepo label-filtered query scenarios, as you explained.

  2. DOM assertion for newIssuesURL test (comment on lines 108-123): Fixed in ce9b996 — added excludeGithubLinks: false to the test config and added a DOM assertion that the rendered "File an issue" link uses the custom URL.

  3. edDraftURI opt-out via hasOwnProperty (comment on lines 204-205): No change needed — the hasOwnProperty("edDraftURI") guard correctly skips auto-generation when the author explicitly sets the value (including null or ""), and the two new tests verify both paths.

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.

Using github while disabling edDraftURI Custom URL for issues

3 participants