Skip to content

Commit 7c60d51

Browse files
authored
Centralize Java team-memory coordination in Java Pack (#1769)
1 parent 0823dbd commit 7c60d51

2 files changed

Lines changed: 136 additions & 28 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Coordinate Java team memory (opt-in)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
source_repository:
7+
description: Allowlisted Java source repository (owner/name)
8+
required: true
9+
default: microsoft/vscode-java-pack
10+
type: string
11+
source_run_id:
12+
description: Source push workflow run ID (automatic dispatch only)
13+
required: false
14+
type: string
15+
source_run_attempt:
16+
description: Source workflow attempt (required with source_run_id)
17+
required: false
18+
type: string
19+
push_before:
20+
description: Requested reconciliation ancestor SHA, not an attested original push boundary
21+
required: false
22+
type: string
23+
push_after:
24+
description: Source push run head SHA (required with source_run_id)
25+
required: false
26+
type: string
27+
pull_request_number:
28+
description: Merged source PR to reconcile manually (instead of source inputs)
29+
required: false
30+
type: string
31+
32+
permissions: {}
33+
34+
concurrency:
35+
group: issuelens-team-memory-wiki-microsoft-vscode-java-pack
36+
queue: max
37+
cancel-in-progress: false
38+
39+
jobs:
40+
reconcile:
41+
if: >-
42+
vars.ISSUELENS_TEAM_MEMORY_COORDINATOR_ENABLED == 'true' &&
43+
github.repository == 'microsoft/vscode-java-pack' &&
44+
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
45+
github.event_name == 'workflow_dispatch'
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 30
48+
permissions:
49+
contents: read
50+
pull-requests: read
51+
actions: read
52+
id-token: write
53+
env:
54+
ISSUELENS_SOURCE_REPOSITORIES: >-
55+
{"microsoft/vscode-java-pack":104967329,
56+
"microsoft/vscode-java-debug":102584737,
57+
"microsoft/vscode-java-test":110522074,
58+
"microsoft/vscode-java-dependency":129053101,
59+
"microsoft/vscode-maven":116921700,
60+
"microsoft/vscode-gradle":216314492,
61+
"microsoft/java-debug":102583752,
62+
"microsoft/build-server-for-gradle":626812412}
63+
steps:
64+
- name: Select allowlisted source for read-only authentication
65+
id: selection
66+
shell: bash
67+
env:
68+
SOURCE_REPOSITORY: ${{ inputs.source_repository }}
69+
run: |
70+
if ! jq -e --arg repository "$SOURCE_REPOSITORY" 'has($repository)' <<< "$ISSUELENS_SOURCE_REPOSITORIES" > /dev/null; then
71+
echo "::error::Source repository is not allowlisted"
72+
exit 1
73+
fi
74+
echo "source-name=${SOURCE_REPOSITORY#microsoft/}" >> "$GITHUB_OUTPUT"
75+
if [[ "$SOURCE_REPOSITORY" == "microsoft/vscode-java-pack" ]]; then
76+
echo "external=false" >> "$GITHUB_OUTPUT"
77+
else
78+
echo "external=true" >> "$GITHUB_OUTPUT"
79+
fi
80+
81+
- name: Get read-only token for the selected external source
82+
if: steps.selection.outputs.external == 'true'
83+
id: source-token
84+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
85+
with:
86+
client-id: ${{ secrets.ISSUELENS_SOURCE_READ_APP_CLIENT_ID }}
87+
private-key: ${{ secrets.ISSUELENS_SOURCE_READ_APP_PRIVATE_KEY }}
88+
owner: microsoft
89+
repositories: ${{ steps.selection.outputs.source-name }}
90+
permission-actions: read
91+
permission-contents: read
92+
permission-pull-requests: read
93+
94+
- name: Reconcile team memory and validate final receipts
95+
uses: microsoft/IssueLens/.github/actions/issuelens@a81d2d96167fc0e69ac631c2edc85f858e693289
96+
with:
97+
request-type: team-memory
98+
github-token: ${{ github.token }}
99+
source-repository: ${{ inputs.source_repository }}
100+
source-repositories: ${{ env.ISSUELENS_SOURCE_REPOSITORIES }}
101+
source-github-token: ${{ steps.selection.outputs.external == 'false' && github.token || steps.source-token.outputs.token }}
102+
source-run-id: ${{ inputs.source_run_id }}
103+
source-run-attempt: ${{ inputs.source_run_attempt }}
104+
push-before: ${{ inputs.push_before }}
105+
push-after: ${{ inputs.push_after }}
106+
pull-request-number: ${{ inputs.pull_request_number }}
107+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
108+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
109+
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
110+
agent-url: ${{ secrets.ISSUELENS_AGENT_URL }}
111+
agent-scope: ${{ secrets.ISSUELENS_AGENT_SCOPE }}
112+
output-mode: activity
113+
summary-mode: status
Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
1-
name: Update IssueLens Team Memory
1+
name: Queue Java team memory (opt-in)
22

33
on:
44
push:
55
branches: [main]
6-
workflow_dispatch:
7-
inputs:
8-
pull_request_number:
9-
description: 'Merged pull request number to learn from'
10-
required: true
11-
type: string
126

137
permissions: {}
148

15-
concurrency:
16-
group: issuelens-${{ github.repository }}-team-memory-${{ github.event.after || inputs.pull_request_number || github.run_id }}
17-
cancel-in-progress: false
18-
199
jobs:
20-
team-memory:
10+
dispatch:
2111
if: >-
22-
${{ vars.ISSUELENS_TEAM_MEMORY_ENABLED == 'true' &&
12+
${{ vars.ISSUELENS_TEAM_MEMORY_COORDINATOR_ENABLED == 'true' &&
13+
github.repository == 'microsoft/vscode-java-pack' &&
2314
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
24-
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
15+
github.event_name == 'push' &&
16+
github.workflow_sha == github.sha &&
17+
github.event.created == false &&
18+
github.event.deleted == false &&
19+
github.event.forced == false }}
2520
runs-on: ubuntu-latest
26-
timeout-minutes: 30
21+
timeout-minutes: 10
2722
permissions:
2823
contents: read
29-
pull-requests: read
30-
id-token: write
24+
actions: write
3125
steps:
32-
- name: Maintain IssueLens team memory
33-
uses: microsoft/IssueLens/.github/actions/issuelens@2b5317815e15179899014a02c41678620ce2d390
26+
- name: Queue team-memory update
27+
uses: microsoft/IssueLens/.github/actions/queue-team-memory@a81d2d96167fc0e69ac631c2edc85f858e693289
3428
with:
35-
request-type: team-memory
36-
pull-request-number: ${{ inputs.pull_request_number }}
37-
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
38-
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
39-
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
40-
agent-url: ${{ secrets.ISSUELENS_AGENT_URL }}
41-
agent-scope: ${{ secrets.ISSUELENS_AGENT_SCOPE }}
42-
output-mode: activity
43-
summary-mode: status
29+
coordinator-repository: microsoft/vscode-java-pack
30+
coordinator-workflow: team-memory-coordinator.yml
31+
coordinator-ref: main
32+
dispatch-token: ${{ github.token }}
33+
workflow-inputs: >-
34+
{"source_repository":"${{ github.repository }}",
35+
"source_run_id":"${{ github.run_id }}",
36+
"source_run_attempt":"${{ github.run_attempt }}",
37+
"push_before":"${{ github.event.before }}",
38+
"push_after":"${{ github.sha }}"}

0 commit comments

Comments
 (0)