Skip to content

Commit c9a9141

Browse files
heiskrCopilot
andauthored
Address docs teams by numeric ID, not slug (#62730)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f332cf0d-dde1-4be0-8050-24e86dd335da
1 parent 585e680 commit c9a9141

8 files changed

Lines changed: 46 additions & 22 deletions

‎.github/workflows/auto-add-ready-for-doc-review.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ jobs:
3434
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
3535
script: |
3636
try {
37-
await github.rest.teams.getMembershipForUserInOrg({
38-
org: 'github',
39-
team_slug: 'technical-content',
37+
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
38+
// because IDs survive team renames and slugs do not.
39+
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
40+
org_id: 9919,
41+
team_id: 325922,
4042
username: context.payload.sender.login,
4143
});
4244
return true

‎.github/workflows/changelog-prompt.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626
script: |
2727
try {
2828
const pr = context.payload.pull_request;
29-
await github.rest.teams.getMembershipForUserInOrg({
30-
org: 'github',
31-
team_slug: 'docs-content',
29+
// Team is addressed by numeric ID (org github = 9919, team docs-content = 2796154)
30+
// because IDs survive team renames and slugs do not.
31+
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
32+
org_id: 9919,
33+
team_id: 2796154,
3234
username: pr.user.login,
3335
});
3436
core.exportVariable('CONTINUE_WORKFLOW', 'true');

‎.github/workflows/confirm-internal-staff-work-in-docs.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ jobs:
4646
4747
// Don't perform this action with Docs team members
4848
try {
49-
await github.rest.teams.getMembershipForUserInOrg({
50-
org: 'github',
51-
team_slug: 'technical-content',
49+
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
50+
// because IDs survive team renames and slugs do not.
51+
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
52+
org_id: 9919,
53+
team_id: 325922,
5254
username: context.payload.sender.login,
5355
});
5456
// If the user is a Docs team member, we should stop here and not send

‎.github/workflows/copy-api-issue-to-internal.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ jobs:
2626
result-encoding: string
2727
script: |
2828
const triggerer_login = context.payload.sender.login
29+
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
30+
// because IDs survive team renames and slugs do not.
2931
const teamMembers = await github.request(
30-
`/orgs/github/teams/technical-content/members?per_page=100`
32+
`/organizations/9919/team/325922/members?per_page=100`
3133
)
3234
const logins = teamMembers.data.map(member => member.login)
3335
if (logins.includes(triggerer_login)) {

‎.github/workflows/feedback-prompt.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626
script: |
2727
try {
2828
const pr = context.payload.pull_request;
29-
await github.rest.teams.getMembershipForUserInOrg({
30-
org: 'github',
31-
team_slug: 'docs-content',
29+
// Team is addressed by numeric ID (org github = 9919, team docs-content = 2796154)
30+
// because IDs survive team renames and slugs do not.
31+
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
32+
org_id: 9919,
33+
team_id: 2796154,
3234
username: pr.user.login,
3335
});
3436
// Author is in the team. Do nothing!

‎.github/workflows/hubber-contribution-help.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ jobs:
3131
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
3232
script: |
3333
try {
34-
await github.rest.teams.getMembershipForUserInOrg({
35-
org: 'github',
36-
team_slug: 'technical-content',
34+
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
35+
// because IDs survive team renames and slugs do not.
36+
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
37+
org_id: 9919,
38+
team_id: 325922,
3739
username: context.payload.sender.login,
3840
});
3941
return true

‎.github/workflows/os-ready-for-review.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ jobs:
3030
result-encoding: string
3131
script: |
3232
const triggerer_login = context.payload.sender.login
33+
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
34+
// because IDs survive team renames and slugs do not.
3335
const teamMembers = await github.request(
34-
`/orgs/github/teams/technical-content/members?per_page=100`
36+
`/organizations/9919/team/325922/members?per_page=100`
3537
)
3638
const logins = teamMembers.data.map(member => member.login)
3739
if (logins.includes(triggerer_login)) {

‎src/ghes-releases/scripts/deprecate/create-docs-ghes-version-repo.sh‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
version=$1
66
cd ~/Documents/gh/github
7+
8+
# Teams are addressed by numeric ID because IDs survive team renames and slugs do not.
9+
# Some APIs (repo creation, CODEOWNERS, custom properties) only accept slugs, so
10+
# resolve the current slug from the ID at runtime rather than hardcoding it.
11+
org_id=9919
12+
docs_team_id=325922
13+
docs_eng_team_id=3935808
14+
docs_team=$(gh api "/organizations/$org_id/team/$docs_team_id" --jq .slug)
15+
docs_eng_team=$(gh api "/organizations/$org_id/team/$docs_eng_team_id" --jq .slug)
16+
717
echo "--- Creating repository for github/docs-ghes-$version"
818
echo "--- gh repo create"
919
gh repo create \
@@ -15,7 +25,7 @@ gh repo create \
1525
--disable-wiki \
1626
--license="CC-BY-4.0" \
1727
--private \
18-
--team="docs-engineering" \
28+
--team="$docs_eng_team" \
1929
--homepage="https://github.github.com/docs-ghes-$version/"
2030
echo "--- gh repo edit"
2131
gh repo edit \
@@ -27,8 +37,8 @@ gh repo edit \
2737
--enable-projects=false \
2838
--enable-merge-commit=false \
2939
--enable-rebase-merge=false
30-
echo "--- github/docs-engineering as admin"
31-
gh api -X PUT "/orgs/github/teams/docs-engineering/repos/github/docs-ghes-$version" \
40+
echo "--- github/$docs_eng_team as admin"
41+
gh api -X PUT "/organizations/$org_id/team/$docs_eng_team_id/repos/github/docs-ghes-$version" \
3242
-f 'permission=admin' --silent
3343
echo "--- github/employees as read"
3444
gh api -X PUT "/orgs/github/teams/employees/repos/github/docs-ghes-$version" --silent
@@ -66,15 +76,15 @@ gh api -X POST "/repos/github/docs-ghes-$version/pages" \
6676
echo "--- Update custom properties"
6777
gh api --method PATCH /repos/github/docs-ghes-$version/properties/values \
6878
-f "properties[][property_name]=ownership-name" \
69-
-f "properties[][value]=@github/docs" \
79+
-f "properties[][value]=@github/$docs_team" \
7080
-f "properties[][property_name]=ownership-type" \
7181
-f "properties[][value]=Team" \
7282
--silent
7383
echo "--- FILE UPDATES"
7484
cd "docs-ghes-$version"
7585
echo "--- docs engineering as codeowners"
7686
touch CODEOWNERS
77-
echo "* @github/docs-engineering" > CODEOWNERS
87+
echo "* @github/$docs_eng_team" > CODEOWNERS
7888
echo "--- add index.html file"
7989
touch index.html
8090
echo "<h1>GitHub Enterprise Server $version Docs</h1>" > index.html

0 commit comments

Comments
 (0)