Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/repository-reconciliation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ jobs:
const owner = context.repo.owner;
const repo = context.repo.repo;
const repoFullName = `${owner}/${repo}`;
const escapedRepoFullName = repoFullName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const now = Date.now();
const staleAfterMs = 14 * 24 * 60 * 60 * 1000;
const closingPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s+#(\d+)/gi;
const closingPattern = new RegExp(
`(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\\s+(?:${escapedRepoFullName})?#(\\d+)`,
"gi"
);

const pulls = await github.paginate(github.rest.pulls.list, {
owner, repo, state: "open", per_page: 100
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_repository_reconciliation_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ def test_reconciliation_workflow_validates_issue_numbers_via_api() -> None:
assert "404" in script


def test_reconciliation_workflow_accepts_same_repo_qualified_closing_refs() -> None:
"""Canonical issue detection must accept `Closes owner/repo#123` for this repo."""
script = _get_script(_load_workflow())
assert "escapedRepoFullName" in script, (
"Closing-reference parsing should escape the current repo name so fully qualified"
" same-repo references are accepted."
)
assert "repoFullName" in script, (
"Closing-reference parsing should derive the fully qualified repo prefix from"
" the current workflow repository context."
)
Comment on lines +73 to +80


def test_reconciliation_workflow_restricts_active_heads_to_same_repo() -> None:
"""activeHeads must only include branches from the same repository, not forks."""
script = _get_script(_load_workflow())
Expand Down
Loading