33---
44# fullsend shim workflow (per-repo installation mode)
55# Routes events to agent workflows via reusable-dispatch.yml.
6- # All agent execution happens in this repo's context — no external
7- # config repo is needed.
6+ # All agent execution happens in this repository's context.
87#
9- # Security: pull_request_target runs the BASE branch version of this workflow,
10- # preventing PRs from modifying it to exfiltrate credentials.
11- # This shim never checks out PR code, so it is not vulnerable to "pwn request"
12- # attacks.
8+ # Security: pull request events use pull_request, not pull_request_target
9+ # (GitHub blocks pull_request_target by default in public repositories;
10+ # ADR 0164). On pull_request this workflow runs from the PR's own
11+ # copy and forwards the repository secrets, so the dispatch job runs only for
12+ # same-repo PRs, whose authors already have write access. Fork PRs are skipped
13+ # here and again in reusable-dispatch.yml (a fork cannot edit the upstream
14+ # copy; a vendored copy runs from the PR); a maintainer comments /fs-review
15+ # to review one. In private repositories keep "Send secrets to workflows
16+ # from pull requests" and "Send write tokens to workflows from pull
17+ # requests" (Settings > Actions > General) turned off.
18+ # reusable-dispatch.yml checks out the base side for pull request events.
1319#
1420# Routing: this shim forwards the raw event context to reusable-dispatch.yml,
1521# which determines the stage and runs the agent inline (ADR 62).
2430 types : [opened, edited, labeled]
2531 issue_comment :
2632 types : [created]
27- pull_request_target :
33+ pull_request :
2834 types : [opened, synchronize, ready_for_review, closed, labeled, unlabeled]
2935 pull_request_review :
3036 types : [submitted]
@@ -34,31 +40,38 @@ permissions: {}
3440jobs :
3541 dispatch :
3642 if : >-
37- (github.event_name != 'pull_request_target ' && github.event_name != 'pull_request_review'
43+ (github.event_name != 'pull_request ' && github.event_name != 'pull_request_review'
3844 || github.event.pull_request.head.ref != 'fullsend/scaffold-install')
45+ && (github.event_name != 'pull_request'
46+ || github.event.pull_request.head.repo.id == github.repository_id)
3947 && (github.event_name != 'issue_comment'
40- || (startsWith(github.event.comment.body, '/fs-')
41- && github.event.comment.user.type != 'Bot'))
48+ || startsWith(github.event.comment.body, '/fs-'))
4249 permissions :
4350 actions : write
4451 id-token : write
4552 contents : write
4653 issues : write
4754 packages : read
4855 pull-requests : write
49- uses : fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@d5f36921ac754705619f38c637ef692873809fbc # v0.43.0
56+ uses : fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@main
5057 with :
5158 event_action : ${{ github.event.action }}
52- install_mode : per-repo
5359 mint_url : ${{ vars.FULLSEND_MINT_URL }}
5460 gcp_region : ${{ vars.FULLSEND_GCP_REGION }}
5561 project_number : ${{ vars.FULLSEND_PROJECT_NUMBER }}
5662 runner_image : ubuntu-24.04
5763 secrets :
5864 FULLSEND_GCP_WIF_PROVIDER : ${{ secrets.FULLSEND_GCP_WIF_PROVIDER }}
5965 FULLSEND_GCP_PROJECT_ID : ${{ secrets.FULLSEND_GCP_PROJECT_ID }}
66+ FULLSEND_OPENAI_API_KEY : ${{ secrets.FULLSEND_OPENAI_API_KEY }}
67+ FULLSEND_INFERENCE_GATEWAY_API_KEY : ${{ secrets.FULLSEND_INFERENCE_GATEWAY_API_KEY }}
6068 OTEL_EXPORTER_OTLP_TRACES_HEADERS : ${{ secrets.OTEL_EXPORTER_OTLP_TRACES_HEADERS }}
6169 OTEL_EXPORTER_OTLP_HEADERS : ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
70+ FULLSEND_JIRA_TOKEN : ${{ secrets.FULLSEND_JIRA_TOKEN }}
71+ FULLSEND_JIRA_EMAIL : ${{ secrets.FULLSEND_JIRA_EMAIL }}
72+ FULLSEND_JIRA_CLIENT_ID : ${{ secrets.FULLSEND_JIRA_CLIENT_ID }}
73+ FULLSEND_JIRA_CLIENT_SECRET : ${{ secrets.FULLSEND_JIRA_CLIENT_SECRET }}
74+ FULLSEND_GITHUB_RUNNER_SECRETS : ${{ secrets.FULLSEND_GITHUB_RUNNER_SECRETS }}
6275
6376 stop-fix :
6477 # Job-level if: is intentionally coarse — it only screens for the
@@ -89,15 +102,30 @@ jobs:
89102 # ADR 0054: authorize via the collaborator permission API
90103 # (admin|maintain|write), not author_association — the latter grants
91104 # contributor status to anyone with a single merged PR (issue #5421).
92- # Mirrors has_repo_permission() in dispatch.yml; keep the two in sync.
105+ # Mirrors has_repo_permission() in reusable-dispatch.yml, including the
106+ # custom-role --jq resolution; keep the two in sync.
93107 # The PR author may always stop the fix agent on their own PR.
94108 authorized=false
95109 if [[ -n "$COMMENT_USER_LOGIN" && "$COMMENT_USER_LOGIN" == "$ISSUE_USER_LOGIN" ]]; then
96110 authorized=true
97111 else
98112 if api_err=$(mktemp); then
113+ # $p is a jq variable; the single quotes are intentional.
114+ # shellcheck disable=SC2016
99115 if role=$(gh api "repos/$REPO/collaborators/$COMMENT_USER_LOGIN/permission" \
100- --jq '.role_name' 2>"$api_err"); then
116+ --jq '.user.permissions as $p
117+ | if (.role_name | type) != "string" or .role_name == "" then "none"
118+ elif (.role_name | IN("admin", "maintain", "write", "triage", "read")) then .role_name
119+ elif $p == null then
120+ if (.permission | IN("admin", "write", "read")) then .permission else "none" end
121+ elif ($p | type) == "object" then
122+ if $p.admin == true then "admin"
123+ elif $p.maintain == true then "maintain"
124+ elif $p.push == true then "write"
125+ elif $p.triage == true then "triage"
126+ elif $p.pull == true then "read"
127+ else "none" end
128+ else "none" end' 2>"$api_err"); then
101129 case "$role" in
102130 admin|maintain|write) authorized=true ;;
103131 esac
@@ -115,7 +143,7 @@ jobs:
115143 fi
116144 gh label create "fullsend-no-fix" --repo "$REPO" \
117145 --description "Skip bot-triggered fix agent runs" --color "FBCA04" \
118- --force 2>/dev/null || true
146+ 2>/dev/null || true
119147 gh pr edit "$PR_NUMBER" --repo "$REPO" \
120148 --add-label "fullsend-no-fix"
121149 gh pr comment "$PR_NUMBER" --repo "$REPO" \
0 commit comments