mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
chore(ci): stop auto-filing community PRs onto the project board (#23796)
Removes the Track Community PRs workflow. Community pull requests will no longer be added to project stablyai/13 automatically.
This commit is contained in:
@@ -132,11 +132,10 @@ jobs:
|
||||
print(src)
|
||||
PY
|
||||
|
||||
# Why: reuse the existing buf0-bot GitHub App (also used by
|
||||
# track-community-prs.yaml) instead of minting a new PAT. The app is
|
||||
# installed org-wide, so it has access to stablyai/homebrew-orca
|
||||
# automatically. GITHUB_TOKEN cannot push cross-repo; a short-lived
|
||||
# installation token can.
|
||||
# Why: reuse the existing buf0-bot GitHub App instead of minting a new
|
||||
# PAT. The app is installed org-wide, so it has access to
|
||||
# stablyai/homebrew-orca automatically. GITHUB_TOKEN cannot push
|
||||
# cross-repo; a short-lived installation token can.
|
||||
- name: Generate buf0-bot token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v3
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
name: Track Community PRs
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: 'PR number to backfill or retry'
|
||||
required: true
|
||||
type: number
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
track-community-pr:
|
||||
# API-only bookkeeping fits the free single-CPU container runner.
|
||||
runs-on: ubuntu-slim
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Generate bufo-bot token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: 2590194
|
||||
private-key: ${{ secrets.BUFO_BOT_PRIVATE_KEY }}
|
||||
owner: stablyai
|
||||
|
||||
- name: Add PR to project
|
||||
uses: actions/github-script@v8
|
||||
env:
|
||||
PROJECT_OWNER: stablyai
|
||||
PROJECT_NUMBER: '13'
|
||||
INTERNAL_TEAM_SLUG: stably-eng
|
||||
with:
|
||||
github-token: ${{ steps.app-token.outputs.token }}
|
||||
script: |
|
||||
const projectOwner = process.env.PROJECT_OWNER;
|
||||
const projectNumber = Number(process.env.PROJECT_NUMBER);
|
||||
const internalTeamSlug = process.env.INTERNAL_TEAM_SLUG;
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
|
||||
const prNumber = context.eventName === 'workflow_dispatch'
|
||||
? Number(context.payload.inputs.pr_number)
|
||||
: context.payload.pull_request.number;
|
||||
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: prNumber,
|
||||
});
|
||||
|
||||
const author = pr.user.login;
|
||||
|
||||
const skippedAuthors = new Set([
|
||||
'github-actions[bot]',
|
||||
'dependabot[bot]',
|
||||
]);
|
||||
|
||||
if (skippedAuthors.has(author)) {
|
||||
core.info(`Skipping bot PR author ${author}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
let isInternalAuthor = false;
|
||||
try {
|
||||
const membership = await github.rest.teams.getMembershipForUserInOrg({
|
||||
org: projectOwner,
|
||||
team_slug: internalTeamSlug,
|
||||
username: author,
|
||||
});
|
||||
isInternalAuthor = membership.data.state === 'active';
|
||||
} catch (error) {
|
||||
if (error.status !== 404) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInternalAuthor) {
|
||||
core.info(`Skipping internal PR author ${author}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const projectResult = await github.graphql(
|
||||
`
|
||||
query($owner: String!, $number: Int!) {
|
||||
organization(login: $owner) {
|
||||
projectV2(number: $number) {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ owner: projectOwner, number: projectNumber },
|
||||
);
|
||||
|
||||
const projectId = projectResult.organization.projectV2.id;
|
||||
|
||||
await github.graphql(
|
||||
`
|
||||
mutation($projectId: ID!, $contentId: ID!) {
|
||||
addProjectV2ItemById(input: {
|
||||
projectId: $projectId,
|
||||
contentId: $contentId
|
||||
}) {
|
||||
item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
projectId,
|
||||
contentId: pr.node_id,
|
||||
},
|
||||
);
|
||||
|
||||
core.info(`Added PR #${pr.number} (${pr.html_url}) to project ${projectOwner}/${projectNumber}.`);
|
||||
Reference in New Issue
Block a user