diff --git a/.github/actions/issuelens/README.md b/.github/actions/issuelens/README.md index 50b23ca..f797a3f 100644 --- a/.github/actions/issuelens/README.md +++ b/.github/actions/issuelens/README.md @@ -376,7 +376,7 @@ identity check is not authorization for any additional repositories named by a t | `source-run-attempt` | With `source-run-id` | Positive originating run attempt. | | `push-before`, `push-after` | With `source-run-id` | Full nonzero requested ancestor/source-run-head SHAs. Supply all four run/range inputs, never with `pull-request-number`. Before is not an attested original event boundary. | | `transport` | No | `foundry` (default for existing callers) or `bridge` (IssueLens pilot only). | -| `bridge-url` | For `bridge` | Complete approved HTTPS Azure Function jobs endpoint. | +| `bridge-url` | For `bridge` | Complete approved HTTPS Azure Function jobs endpoint. Pass it from the `ISSUELENS_BRIDGE_URL` Actions secret, not a configuration variable. | | `azure-client-id` | For `foundry` | Existing Azure OIDC identity's client ID. | | `azure-tenant-id` | For `foundry` | Tenant used by Azure login. | | `azure-subscription-id` | For `foundry` | Subscription used by Azure login. | diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml index 132110d..6497c69 100644 --- a/.github/workflows/issue-triage.yml +++ b/.github/workflows/issue-triage.yml @@ -6,7 +6,7 @@ # .github/issuelens.yml, not in this workflow. # # After the isolated Function bridge is approved, set the ISSUELENS_BRIDGE_URL -# repository variable and opt in with ISSUELENS_ISSUE_LOOP_ENABLED=true. +# repository secret and opt in with ISSUELENS_ISSUE_LOOP_ENABLED=true. # This workflow authenticates only to the bridge. The worker's Azure identity # invokes Foundry; the hosted agent still owns all GitHub App writes. @@ -36,7 +36,6 @@ jobs: orchestrate: if: >- vars.ISSUELENS_ISSUE_LOOP_ENABLED == 'true' && - vars.ISSUELENS_BRIDGE_URL != '' && github.repository == 'microsoft/IssueLens' && (github.event_name != 'issue_comment' || (github.event.issue.pull_request == null && @@ -45,12 +44,15 @@ jobs: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) runs-on: ubuntu-latest timeout-minutes: 45 + env: + ISSUELENS_BRIDGE_CONFIGURED: ${{ secrets.ISSUELENS_BRIDGE_URL != '' && 'true' || 'false' }} permissions: contents: read issues: read id-token: write steps: - name: Load action from trusted workflow revision + if: env.ISSUELENS_BRIDGE_CONFIGURED == 'true' uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.workflow_sha }} @@ -59,9 +61,10 @@ jobs: sparse-checkout-cone-mode: false - name: Process issue event + if: env.ISSUELENS_BRIDGE_CONFIGURED == 'true' uses: ./.github/actions/issuelens with: request-type: issue-loop issue-number: ${{ inputs.issue_number }} transport: bridge - bridge-url: ${{ vars.ISSUELENS_BRIDGE_URL }} \ No newline at end of file + bridge-url: ${{ secrets.ISSUELENS_BRIDGE_URL }} \ No newline at end of file diff --git a/.github/workflows/team-memory-coordinator.yml b/.github/workflows/team-memory-coordinator.yml index c0c7b77..f4e50f4 100644 --- a/.github/workflows/team-memory-coordinator.yml +++ b/.github/workflows/team-memory-coordinator.yml @@ -40,12 +40,13 @@ jobs: if: >- (vars.ISSUELENS_TEAM_MEMORY_ENABLED == 'true' || (vars.ISSUELENS_TEAM_MEMORY_MANUAL_PILOT == 'true' && inputs.pull_request_number != '')) && - vars.ISSUELENS_BRIDGE_URL != '' && github.repository == 'microsoft/IssueLens' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest timeout-minutes: 45 + env: + ISSUELENS_BRIDGE_CONFIGURED: ${{ secrets.ISSUELENS_BRIDGE_URL != '' && 'true' || 'false' }} permissions: contents: read pull-requests: read @@ -53,6 +54,7 @@ jobs: id-token: write steps: - name: Load action from trusted workflow revision + if: env.ISSUELENS_BRIDGE_CONFIGURED == 'true' uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.workflow_sha }} @@ -61,6 +63,7 @@ jobs: sparse-checkout-cone-mode: false - name: Maintain team memory + if: env.ISSUELENS_BRIDGE_CONFIGURED == 'true' uses: ./.github/actions/issuelens with: request-type: team-memory @@ -71,4 +74,4 @@ jobs: push-after: ${{ inputs.push_after }} pull-request-number: ${{ inputs.pull_request_number }} transport: bridge - bridge-url: ${{ vars.ISSUELENS_BRIDGE_URL }} + bridge-url: ${{ secrets.ISSUELENS_BRIDGE_URL }} diff --git a/docs/guide.md b/docs/guide.md index 8007e60..16acf33 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -1092,9 +1092,11 @@ Keep direct endpoint access limited to approved callers. The GitHub workflow for deploying the agent is separate from this migration and still requires an approved replacement for its retired identity. -Set the repository variable `ISSUELENS_BRIDGE_URL` to the approved ingress -jobs URL only when the bridge and worker RBAC are ready. Verify that -out-of-scope workflows and jobs are rejected before enabling the workflows. +Set the Actions repository secret `ISSUELENS_BRIDGE_URL` to the approved +ingress jobs URL only when the bridge and worker RBAC are ready. Do not keep +a repository variable with the same name. If the secret is unavailable, the +workflows skip checkout and invocation. Verify that out-of-scope workflows +and jobs are rejected before enabling the workflows. The existing deployed agent can write, so treat a live invocation as a write-capable test, not a dry run. After approval, set `ISSUELENS_ISSUE_LOOP_ENABLED=true` for issue events. Enable diff --git a/tests/test_issue_triage_workflow.py b/tests/test_issue_triage_workflow.py index 28b847c..0cf4ea8 100644 --- a/tests/test_issue_triage_workflow.py +++ b/tests/test_issue_triage_workflow.py @@ -42,10 +42,15 @@ def test_caller_is_thin_and_loads_trusted_action(self): self.assertEqual(invoke["uses"], "./.github/actions/issuelens") self.assertEqual(invoke["with"]["request-type"], "issue-loop") self.assertEqual(invoke["with"]["transport"], "bridge") - self.assertEqual(invoke["with"]["bridge-url"], "${{ vars.ISSUELENS_BRIDGE_URL }}") + self.assertEqual(invoke["with"]["bridge-url"], "${{ secrets.ISSUELENS_BRIDGE_URL }}") + self.assertEqual(self.job["env"], { + "ISSUELENS_BRIDGE_CONFIGURED": "${{ secrets.ISSUELENS_BRIDGE_URL != '' && 'true' || 'false' }}", + }) + for step in (checkout, invoke): + self.assertEqual(step["if"], "env.ISSUELENS_BRIDGE_CONFIGURED == 'true'") self.assertEqual(invoke["with"]["issue-number"], "${{ inputs.issue_number }}") self.assertIn("vars.ISSUELENS_ISSUE_LOOP_ENABLED == 'true'", self.job["if"]) - self.assertIn("vars.ISSUELENS_BRIDGE_URL != ''", self.job["if"]) + self.assertNotIn("ISSUELENS_BRIDGE_URL", self.job["if"]) self.assertIn("github.repository == 'microsoft/IssueLens'", self.job["if"]) self.assertNotIn("secrets.AZURE_", self.source) self.assertEqual(self.workflow["permissions"], {}) diff --git a/tests/test_team_memory_workflow.py b/tests/test_team_memory_workflow.py index 54eb508..983ba39 100644 --- a/tests/test_team_memory_workflow.py +++ b/tests/test_team_memory_workflow.py @@ -204,8 +204,13 @@ def test_local_caller_loads_only_trusted_action_revision(self): self.assertEqual(invoke["uses"], "./.github/actions/issuelens") self.assertEqual(invoke["with"]["request-type"], "team-memory") self.assertEqual(invoke["with"]["transport"], "bridge") - self.assertEqual(invoke["with"]["bridge-url"], "${{ vars.ISSUELENS_BRIDGE_URL }}") - self.assertIn("vars.ISSUELENS_BRIDGE_URL != ''", self.job["if"]) + self.assertEqual(invoke["with"]["bridge-url"], "${{ secrets.ISSUELENS_BRIDGE_URL }}") + self.assertEqual(self.job["env"], { + "ISSUELENS_BRIDGE_CONFIGURED": "${{ secrets.ISSUELENS_BRIDGE_URL != '' && 'true' || 'false' }}", + }) + for step in (checkout, invoke): + self.assertEqual(step["if"], "env.ISSUELENS_BRIDGE_CONFIGURED == 'true'") + self.assertNotIn("ISSUELENS_BRIDGE_URL", self.job["if"]) self.assertIn("vars.ISSUELENS_TEAM_MEMORY_MANUAL_PILOT == 'true' && inputs.pull_request_number != ''", self.job["if"]) self.assertNotIn("secrets.AZURE_", self.source) self.assertTrue(set(invoke["with"]).issubset(self.action_metadata["inputs"]))