Skip to content

ci: add basic codeql workflow file - #1675

Open
serena256 wants to merge 3 commits into
devfrom
af/codeql
Open

serena256 wants to merge 3 commits into
devfrom
af/codeql

Conversation

@serena256

@serena256 serena256 commented Nov 17, 2026 •

Copy link
Copy Markdown

Part of #1655

What and why

Add a basic CodeQL security-scanning workflow for Rust, Python, and GitHub Actions.

Scans run on pushes and pull requests targeting dev, merge-queue checks, Mondays at 07:00 UTC, or manually. Analysis runs on Ubuntu without building the project and reports findings to GitHub Code scanning alerts.

Validation

Copilot AI balanced review requested due to automatic review settings November 17, 2026 00:32
@serena256
serena256 marked this pull request as draft November 17, 2026 00:32

Copilot AI left a comment

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.

🟡 Changes recommended

The CodeQL job lacks the draft-PR guard required by repository policy and a ready_for_review trigger to start scans when a draft becomes ready.

1 open issue
What changed in this PR

Adds a dedicated CodeQL workflow to scan NVX’s Rust, Python, and GitHub Actions code for security issues.

Changes:

  • Runs scans on pushes and pull requests targeting dev, merge groups, a weekly schedule, and manual dispatch.
  • Analyzes each language separately using CodeQL v4 with no-build extraction.
  • Grants read access to repository contents and write access to security events.
File Description
.github/​workflows/​codeql-analysis.yml Adds triggers, permissions, and a three-language CodeQL analysis matrix.

Review effort: Balanced

Comment thread .github/workflows/codeql-analysis.yml Resolved
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py,
reads the pull request through gh api and passes it when GitHub links
it to an issue of the repository (closingIssuesReferences) or when
its description holds close, fix, resolve (in any form), Part of, or
Refs, with an optional colon, then #N, microsoft/nvx#N, or the
issue's URL, where N is an issue. A pull request's number, a missing
number, a bare #N, another repository's issue, and references in HTML
comments or Markdown code do not count, nor does a keyword that one
of them or the end of a block separates from its number: the script
reads quotes, lists, headings, code, and comments as CommonMark does.
It looks up at most the first 10 numbers, so a description cannot
make it call the API without bound. Pull requests by dependabot[bot]
or github-actions[bot], or labelled no-issue, are exempt, and closed
ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1678, which
GitHub links to #1677, flag #1675, #1516, and #1509, as reading
their descriptions confirms, and leave merged pull requests such
as #1672 alone; before they merged, they passed #1674, which
GitHub linked to #1666, and flagged #1671.

test_issue_link.py covers the parser, with indented code, fences that
end with their container, and hidden text or a block end between a
keyword and its number; the verdicts and the writes through a fake gh
api, the bound on lookups, an API error at each read, a comment that
quotes the marker, and the workflow's triggers, permissions, checkout,
concurrency, and inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py,
reads the pull request through gh api and passes it when GitHub links
it to an issue of the repository (closingIssuesReferences) or when
its description holds close, fix, resolve (in any form), Part of, or
Refs, with an optional colon, then #N, microsoft/nvx#N, or the
issue's URL, where N is an issue. A pull request's number, a missing
number, a bare #N, another repository's issue, and references in HTML
comments or Markdown code do not count, nor does a keyword that one
of them or the end of a block separates from its number: the script
reads quotes, lists, headings, code, and comments as CommonMark does.
It looks up at most the first 10 numbers, so a description cannot
make it call the API without bound. Pull requests by dependabot[bot]
or github-actions[bot], or labelled no-issue, are exempt, and closed
ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1678, which
GitHub links to #1677, flag #1675, #1516, and #1509, as reading
their descriptions confirms, and leave merged pull requests such
as #1672 alone; before they merged, they passed #1674, which
GitHub linked to #1666, and flagged #1671.

test_issue_link.py covers the parser, with indented code, fences that
end with their container, and hidden text or a block end between a
keyword and its number; the verdicts and the writes through a fake gh
api, the bound on lookups, an API error at each read, a comment that
quotes the marker, and the workflow's triggers, permissions, checkout,
concurrency, and inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py,
reads the pull request through gh api and passes it when GitHub links
it to an issue of the repository (closingIssuesReferences) or when
its description holds close, fix, resolve (in any form), Part of, or
Refs, with an optional colon, then #N, microsoft/nvx#N, or the
issue's URL, where N is an issue. A pull request's number, a missing
number, a bare #N, another repository's issue, and references in HTML
comments or Markdown code do not count, nor does a keyword that one
of them or the end of a block separates from its number: the script
reads quotes, lists, headings, code, and comments as CommonMark does,
and lets a comment run across blocks, as a browser does, until raw
HTML ends it. It looks up at most the first 10 numbers, so a
description cannot make it call the API without bound. Pull requests
by dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1678, which
GitHub links to #1677, flag #1675, #1516, and #1509, as reading
their descriptions confirms, and leave merged pull requests such
as #1672 alone; before they merged, they passed #1674, which
GitHub linked to #1666, and flagged #1671. Each parser case also
agrees with what GitHub's Markdown API renders, apart from a
reference that a comment splits and a pull request's URL.

test_issue_link.py covers the parser, with indented code, fences that
end with their container, setext headings, sibling list items,
comments that outlast their block or end as a browser ends them, and
hidden text or a block end between a keyword and its number; the
verdicts and the writes through a fake gh api, the bound on lookups,
an API error at each read, a comment that quotes the marker or has no
author, and the workflow's triggers, permissions, checkout,
concurrency, and inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py,
reads the pull request through gh api and passes it when GitHub links
it to an issue of the repository (closingIssuesReferences) or when
its description holds close, fix, resolve (in any form), Part of, or
Refs, with an optional colon, then #N, microsoft/nvx#N, or the
issue's URL, where N is an issue. A pull request's number, a missing
number, a bare #N, another repository's issue, and references in HTML
comments or Markdown code do not count, nor does a keyword that one
of them or the end of a block separates from its number: the script
reads quotes, lists, headings, code, and comments as CommonMark does,
and lets a comment run across blocks, as a browser does, until raw
HTML ends it. It looks up at most the first 10 numbers, so a
description cannot make it call the API without bound. Pull requests
by dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1678, which
GitHub links to #1677, flag #1675, #1516, and #1509, as reading
their descriptions confirms, and leave merged pull requests such
as #1672 alone; before they merged, they passed #1674, which
GitHub linked to #1666, and flagged #1671. Each parser case also
agrees with what GitHub's Markdown API renders, apart from a
reference that a comment splits and a pull request's URL.

test_issue_link.py covers the parser, with indented code, fences that
end with their container, setext headings, sibling list items,
comments that outlast their block or end as a browser ends them, and
hidden text or a block end between a keyword and its number; the
verdicts and the writes through a fake gh api, the bound on lookups,
an API error at each read, a comment that quotes the marker or has no
author, and the workflow's triggers, permissions, checkout,
concurrency, and inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py,
reads the pull request through gh api, in UTF-8 whatever the locale,
and passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, another
repository's issue, and references in HTML comments or Markdown code
do not count, nor does a keyword that one of them or the end of a
block separates from its number: the script reads quotes, lists,
headings, code, and HTML blocks as GitHub's CommonMark does, reads
raw HTML as text but for its comments, and lets a comment run across
blocks, as a browser does, until raw HTML ends it. It looks up at
most the first 10 numbers, so a description cannot make it call the
API without bound. Pull requests by dependabot[bot] or
github-actions[bot], or labelled no-issue, are exempt, and closed
ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1678, which
GitHub links to #1677, flag #1675, #1516, and #1509, as reading
their descriptions confirms, and leave merged pull requests such
as #1672 alone; before they merged, they passed #1674, which
GitHub linked to #1666, and flagged #1671. Each parser case also
agrees with what GitHub's Markdown API renders, apart from a
reference that a comment splits, a pull request's URL, and the text
of a declaration, which GitHub hides.

test_issue_link.py covers the parser, with indented code, fences that
end with their container, setext headings, sibling and empty list
items, HTML blocks, comments that outlast their block or end as a
browser ends them, and hidden text or a block end between a keyword
and its number; the verdicts and the writes through a fake gh api,
gh's input and output in UTF-8, the bound on lookups, an API error at
each read, a comment that quotes the marker or has no author, and the
workflow's triggers, permissions, checkout, concurrency, and inputs.
validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py, reads
the pull request through gh api, in UTF-8 whatever the locale, and
passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, and another
repository's issue do not count. The script reads the description as
GitHub renders it, through the Markdown API in the repository's context,
and only the text that GitHub shows counts: not an HTML comment, an
attribute such as a link's title, or code, inline, fenced, indented, or
in <pre>, nor a keyword that code or the end of a block, such as a list
item or a table cell, separates from its number. GitHub's own renderer
keeps the check in step with what the pull request's page shows, which a
parser of CommonMark, GFM tables, and raw HTML written here kept
missing. It looks up at most the first 10 numbers, so a description
cannot make it call the API without bound. Pull requests by
dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1687, #1686,
and #1682, which GitHub links to issues, and #1679, whose description
references #1676, and flag #1675, #1516, #1510, and #1509, as reading
their descriptions confirms. A 64 KiB description renders in about a
second, and its text reads in at most 60 ms.

test_issue_link.py covers the reading of GitHub's HTML, as gh api
markdown renders it: keywords and targets, other repositories, code and
<pre>, attributes, the ends of blocks and table cells, and inline
elements; the verdicts and the writes through a fake gh api, the render
request, gh's input and output in UTF-8, the bound on lookups, an API
error at each read, a comment that quotes the marker or has no author,
and the workflow's triggers, permissions, checkout, concurrency, and
inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py, reads
the pull request through gh api, in UTF-8 whatever the locale, and
passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, and another
repository's issue do not count. The script reads the description as
GitHub renders it, through the Markdown API in the repository's context,
and only the text that GitHub shows counts: not an HTML comment, an
attribute such as a link's title, or code, inline, fenced, indented, or
in <pre>, nor a keyword that code or the end of a block, such as a list
item or a table cell, separates from its number. A link counts by where
it goes, whatever its text: a link to an issue or a pull request as
OWNER/REPO#N, and any other link as code does. GitHub's own renderer
keeps the check in step with what the pull request's page shows, which a
parser of CommonMark, GFM tables, and raw HTML written here kept
missing. It looks up at most the first 10 numbers, so a description
cannot make it call the API without bound. Pull requests by
dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1687, #1686,
and #1682, which GitHub links to issues, and #1679, whose description
references #1676, and flag #1675, #1516, #1510, and #1509, as reading
their descriptions confirms. A 64 KiB description renders in about a
second, and its text reads in at most 60 ms.

test_issue_link.py covers the reading of GitHub's HTML, as gh api
markdown renders it: keywords and targets, other repositories, code and
<pre>, attributes, links, the ends of blocks and table cells, and inline
elements; the verdicts and the writes through a fake gh api, the render
request, gh's input and output in UTF-8, the bound on lookups, an API
error at each read, a comment that quotes the marker or has no author,
and the workflow's triggers, permissions, checkout, concurrency, and
inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py, reads
the pull request through gh api, in UTF-8 whatever the locale, and
passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, and another
repository's issue do not count. The script reads the description as
GitHub renders it, through the Markdown API in the repository's context,
and only the text that GitHub shows counts: not an HTML comment, an
attribute such as a link's title, or code, inline, fenced, indented, or
in <pre>, nor a keyword that code or the end of a block, such as a list
item or a table cell, separates from its number. A link counts by where
it goes, and of its text only a keyword that starts it: a link to an
issue or a pull request, absolute or root-relative, with nothing after
the number other than a slash, a query, or a fragment, as that keyword
and OWNER/REPO#N, and any other link as code does. GitHub's own renderer
keeps the check in step with what the pull request's page shows, which a
parser of CommonMark, GFM tables, and raw HTML written here kept
missing. It looks up at most the first 10 numbers, so a description
cannot make it call the API without bound. Pull requests by
dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1687, #1686,
and #1682, which GitHub links to issues, and #1679, whose description
references #1676, and flag #1675, #1516, #1510, and #1509, as reading
their descriptions confirms. A 64 KiB description renders in about a
second, and its text reads in at most 60 ms.

test_issue_link.py covers the reading of GitHub's HTML, as gh api
markdown renders it: keywords and targets, other repositories, code and
<pre>, attributes, links, the ends of blocks and table cells, and inline
elements; the verdicts and the writes through a fake gh api, the render
request, gh's input and output in UTF-8, the bound on lookups, an API
error at each read, a comment that quotes the marker or has no author,
and the workflow's triggers, permissions, checkout, concurrency, and
inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py, reads
the pull request through gh api, in UTF-8 whatever the locale, and
passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, and another
repository's issue do not count. The script reads the description as
GitHub renders it, through the Markdown API in the repository's context,
and only the text that GitHub shows counts: not an HTML comment, an
attribute such as a link's title, or code, inline, fenced, indented, or
in <pre>, nor a keyword that code or the end of a block, such as a list
item or a table cell, separates from its number. A link counts by where
it goes, and of its text only a keyword that starts it: a link to an
issue or a pull request, absolute or root-relative, with nothing after
the number other than a slash, a query, or a fragment, as that keyword
and OWNER/REPO#N, which no text after the link extends, and any other
link as code does. An issue's URL that GitHub shows as text follows the
same rule, but for the punctuation that ends a sentence. GitHub's own
renderer keeps the check in step with what the pull request's page
shows, which a parser of CommonMark, GFM tables, and raw HTML written
here kept missing. It looks up at most the first 10 numbers, so a
description cannot make it call the API without bound. Pull requests by
dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1687, #1686,
and #1682, which GitHub links to issues, and #1679, whose description
references #1676, and flag #1675, #1516, #1510, and #1509, as reading
their descriptions confirms. A 64 KiB description renders in about a
second, and its text reads in at most 60 ms.

test_issue_link.py covers the reading of GitHub's HTML, as gh api
markdown renders it: keywords and targets, other repositories, code and
<pre>, attributes, links, the ends of blocks and table cells, and inline
elements; the verdicts and the writes through a fake gh api, the render
request, gh's input and output in UTF-8, the bound on lookups, an API
error at each read, a comment that quotes the marker or has no author,
and the workflow's triggers, permissions, checkout, concurrency, and
inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit that referenced this pull request Nov 17, 2026
doc/contribute.md asks every pull request to reference an issue on the
first line of its description, but nothing checks it: pull requests
such as #1675, whose only references sit in the template's HTML
comment, and #1516, whose Refs #1509 names a pull request, reference
no issue, and a reviewer has to notice.

Add the Issue link workflow, which pull_request_target runs, from the
default branch, when a pull request is opened, reopened, pushed to,
edited, labelled, or unlabelled. Its script, check_issue_link.py, reads
the pull request through gh api, in UTF-8 whatever the locale, and
passes it when GitHub links it to an issue of the repository
(closingIssuesReferences) or when its description holds close, fix,
resolve (in any form), Part of, or Refs, with an optional colon,
then #N, microsoft/nvx#N, or the issue's URL, where N is an issue. A
pull request's number, a missing number, a bare #N, and another
repository's issue do not count. The script reads the description as
GitHub renders it, through the Markdown API in the repository's context,
and only the text that GitHub shows counts: not an HTML comment, an
attribute such as a link's title, or code, inline, fenced, indented, or
in <pre>, nor a keyword that code or the end of a block, such as a list
item or a table cell, separates from its number. A link counts by where
it goes, and of its text only a keyword that starts it: a link to an
issue or a pull request, absolute or root-relative, with nothing after
the number other than a slash, a query, or a fragment, as that keyword
and OWNER/REPO#N, which no text after the link extends, and any other
link as code does. An issue's URL that GitHub shows as text follows the
same rule, but for the punctuation that ends a sentence. GitHub's own
renderer keeps the check in step with what the pull request's page
shows, which a parser of CommonMark, GFM tables, and raw HTML written
here kept missing. It looks up at most the first 10 numbers, so a
description cannot make it call the API without bound. Pull requests by
dependabot[bot] or github-actions[bot], or labelled no-issue, are
exempt, and closed ones are left alone.

An unlinked pull request gets the needs-issue label and one marker
comment that says how to reference an issue, and the check fails;
editing the description reruns it, which then removes the label and
rewrites the comment. Only a comment of github-actions[bot] that starts
with the marker is the script's. The script does every read before its
first write, so an API error fails the check and changes nothing, and
its summary names the verdict and the numbers, never the description.

The job has no condition, since a skipped run would replace the
previous verdict, runs one check a pull request at a time, keeps no
checkout credentials, and gets only the pull request's number. Its
token reads contents and writes pull requests; reading an issue of a
public repository needs no issues permission, so the nightly report
and issue labelling stay the only workflows that write issues.

Evidence: dry runs against the live repository pass #1687, #1686,
and #1682, which GitHub links to issues, and #1679, whose description
references #1676, and flag #1675, #1516, #1510, and #1509, as reading
their descriptions confirms. A 64 KiB description renders in about a
second, and its text reads in at most 60 ms.

test_issue_link.py covers the reading of GitHub's HTML, as gh api
markdown renders it: keywords and targets, other repositories, code and
<pre>, attributes, links, the ends of blocks and table cells, and inline
elements; the verdicts and the writes through a fake gh api, the render
request, gh's input and output in UTF-8, the bound on lookups, an API
error at each read, a comment that quotes the marker or has no author,
and the workflow's triggers, permissions, checkout, concurrency, and
inputs. validate-nvx runs it on Linux and Windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pin actions to commit SHAs.
Explicitly disable submodule checkout.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 18:45
@github-actions github-actions Bot added the needs-issue The description references no issue; see Issue link label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request passes the issue link check: its description references #1655.

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues remain for the added CodeQL security-scanning workflow.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@github-actions github-actions Bot removed the needs-issue The description references no issue; see Issue link label Nov 17, 2026
@ppenna
Pedro Henrique Penna (ppenna) marked this pull request as ready for review November 18, 2026 16:12
Copilot AI balanced review requested due to automatic review settings November 18, 2026 19:05

Copilot AI left a comment

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.

🟡 Changes recommended

The CodeQL cron runs daily at 10:00 UTC rather than the documented Monday at 07:00 UTC, triggering seven weekly analyses instead of one.

1 open issue

Review effort: Balanced

- ready_for_review
merge_group:
schedule:
- cron: '0 10 * * *'

This branch has not been deployed

No deployments
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.

3 participants