# Intent Factory Review Check # - A reminder, not an approval gate: fails a PR that changes AttestedBridgeFacet, a bridge facet # it dispatches, or code that shapes their calldata, until someone confirms with the # IntentFactoryReviewed label that the Intent Factory team was consulted or the change does not # affect them # - Why: Intent Factory's BridgeCommitmentLedger trusts what its facts adapters decode from the # calldata these facets execute, so a change here can make an adapter describe a call that no # longer happens # - Adding the label records an `intent-factory-approval` commit status on the head it was added # at. The check passes only when the PR's live head carries that status, so a run triggered by # any other event can never confirm a newer head # - A push removes the label so it can be added again after the next confirmation # - Limitation: anyone with write access, the PR author included, can add the label or post the # status, so it records a confirmation, not a review by the Intent Factory team # - Reads only the event payload and the GitHub API, no checkout name: Intent Factory Review Check on: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled] paths: - 'src/Facets/AttestedBridgeFacet.sol' - 'src/Facets/AcrossFacetV4.sol' - 'src/Facets/PolymerCCTPFacet.sol' - 'src/Facets/LiFiIntentEscrowFacetV2.sol' - 'src/Interfaces/IAttester.sol' - 'src/Interfaces/ILiFi.sol' - 'src/Libraries/LibAttestableSelectors.sol' - 'src/Libraries/LibSwap.sol' - 'src/Helpers/SwapperV2.sol' permissions: {} jobs: intent-factory-review: runs-on: ubuntu-latest timeout-minutes: 5 permissions: pull-requests: write # required to remove the IntentFactoryReviewed label on a new push statuses: write # required to record the approval on the reviewed head steps: - name: Require an Intent Factory approval on the current head env: GH_TOKEN: ${{ github.token }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} EVENT_ACTION: ${{ github.event.action }} EVENT_LABEL: ${{ github.event.label.name }} EVENT_HEAD: ${{ github.event.pull_request.head.sha }} LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} LABEL: IntentFactoryReviewed CONTEXT: intent-factory-approval shell: bash run: | if [[ "$EVENT_ACTION" == "labeled" && "$EVENT_LABEL" == "$LABEL" ]]; then gh api -X POST "repos/$REPO/statuses/$EVENT_HEAD" -f state=success \ -f context="$CONTEXT" -f description="$LABEL label added" >/dev/null fi if [[ "$EVENT_ACTION" == "synchronize" && ",$LABELS," == *",$LABEL,"* ]]; then gh api -X DELETE "repos/$REPO/issues/$PR_NUMBER/labels/$LABEL" >/dev/null fi HEAD=$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq .head.sha) APPROVED=$(gh api "repos/$REPO/commits/$HEAD/statuses" --paginate \ --jq "[.[] | select(.context == \"$CONTEXT\" and .state == \"success\")] | length" \ | awk '{ n += $1 } END { print n + 0 }') if [[ "$APPROVED" == "0" ]]; then echo -e "\033[31mNo Intent Factory confirmation on the current head ($HEAD).\033[0m" echo -e "\033[31mThis PR changes AttestedBridgeFacet, a facet it dispatches,\033[0m" echo -e "\033[31mor code shaping their calldata, which Intent Factory decodes.\033[0m" echo -e "\033[31mCheck with them, then add the $LABEL label.\033[0m" exit 1 fi echo -e "\033[32mIntent Factory confirmation recorded for $HEAD.\033[0m"