#!/usr/bin/env bash # lib/issue_references.sh — the LOCAL / CROSS reference classifier (#61). # # Sourced, never executed: no set -e/-u — the sourcing script owns its shell # options, as lib/closes_references.sh and lib/forge.sh do. # # WHY IT LIVES HERE. It was defined inside actions/issueflow-reconcile's # executable, and lib/closes_references.sh's header recorded the resulting # wart in prose: "DEPENDENCY: issue_references, from issueflow-reconcile.sh". # That was tolerable while the reconciler was its only caller. #199 makes # actions/refs-not-closing a second one, and a composite action cannot source # another action's program to borrow one function — sourcing a reconciler # runs a reconciler. # # So the dependency the comment described is now a file, and both callers # source it the same way. Nothing about the classifier changed. # # A qualified reference belongs to another repository. The whole token is # classified BEFORE any number is extracted, so `rig#112` can never be read # as local `#112` — which is the entire point of the function. issue_references() { # text on stdin -> LOCAL/CROSSreference { grep -Eo '([[:alnum:]_.-]+/)?[[:alnum:]_.-]+#[0-9]+|#[0-9]+' || true; } \ | awk ' index($0, "#") == 1 { print "LOCAL\t" substr($0, 2); next } { print "CROSS\t" $0 } ' }