Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Auto-labeling config for actions/labeler
# Maps file path patterns to area/* labels for PRs
# Part of #696

"area/core":
- changed-files:
- any-glob-to-any-file:
- burr/core/**
- burr/lifecycle/**
- burr/system.py

"area/ui":
- changed-files:
- any-glob-to-any-file:
- telemetry/ui/**

"area/storage":
- changed-files:
- any-glob-to-any-file:
- burr/core/persistence.py
- burr/integrations/persisters/**
- burr/tracking/server/s3/**

"area/streaming":
- changed-files:
- any-glob-to-any-file:
- burr/core/parallelism.py

"area/hooks":
- changed-files:
- any-glob-to-any-file:
- burr/lifecycle/**

"area/tracking":
- changed-files:
- any-glob-to-any-file:
- burr/tracking/**
- burr/telemetry.py
- burr/visibility/**

"area/integrations":
- changed-files:
- any-glob-to-any-file:
- burr/integrations/**

"area/visualization":
- changed-files:
- any-glob-to-any-file:
- burr/visibility/**

"area/website":
- changed-files:
- any-glob-to-any-file:
- website/**
- docs/**

"area/ci":
- changed-files:
- any-glob-to-any-file:
- .github/**
- scripts/**
- .pre-commit-config.yaml
- .rat-excludes
- pyproject.toml
- setup.cfg

"area/examples":
- changed-files:
- any-glob-to-any-file:
- examples/**
- burr/examples/**

"area/typing":
- changed-files:
- any-glob-to-any-file:
- burr/core/typing.py
- burr/integrations/pydantic.py
111 changes: 111 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#<!--
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#-->
# Auto-labeling for new issues and PRs
# Part of #690 (repo governance) and #696 (auto-labeling)
#
# - New issues get status/needs-triage
# - PRs get area/* labels based on changed files
# - PRs get pr/needs-rebase when they have merge conflicts
#
# Security: this workflow only uses numeric IDs from context (issue_number,
# pull_request.number). No untrusted string input is interpolated.

name: Auto-label

on:
issues:
types: [opened]
pull_request_target:
types: [opened, synchronize]

permissions:
contents: read
issues: write
pull-requests: write

jobs:
triage-issues:
if: github.event_name == 'issues'
runs-on: ubuntu-latest
steps:
- name: Add status/needs-triage to new issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['status/needs-triage']
});

label-prs:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Apply area/* labels based on changed files
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yml
sync-labels: false

check-mergeable:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Check for merge conflicts
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const LABEL = 'pr/needs-rebase';

// Wait for GitHub to compute mergeability
await new Promise(r => setTimeout(r, 5000));

const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});

const labels = pr.labels.map(l => l.name);
const hasLabel = labels.includes(LABEL);

if (pr.mergeable === false && !hasLabel) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [LABEL],
});
console.log(`#${pr.number}: added ${LABEL}`);
} else if (pr.mergeable === true && hasLabel) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: LABEL,
});
console.log(`#${pr.number}: removed ${LABEL}`);
} else {
console.log(`#${pr.number}: no change (mergeable=${pr.mergeable}, hasLabel=${hasLabel})`);
}
170 changes: 170 additions & 0 deletions .github/workflows/stale-assignments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#<!--
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#-->
# Stale issue assignment check
# Part of #690 (repo governance) and #709 (assignment policy)
#
# Policy (documented in CONTRIBUTING.rst):
# - 14 days without activity on an assigned issue -> comment asking for update
# - 21 days total -> unassign + add help wanted
# - Issues with lifecycle/frozen are exempt
#
# Security: only uses numeric IDs and login names from the GitHub API.
# No untrusted string input is interpolated into shell commands.

name: Stale Assignments

on:
schedule:
- cron: "0 9 * * 3" # Every Wednesday at 09:00 UTC
workflow_dispatch:

permissions:
issues: write

jobs:
check-assignments:
runs-on: ubuntu-latest
steps:
- name: Check for stale assignments
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const WARN_DAYS = 14;
const UNASSIGN_DAYS = 21;
const SKIP_LABELS = ['lifecycle/frozen'];
const now = new Date();

let page = 1;
let allIssues = [];

// Paginate through all open issues
while (true) {
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
per_page: 100,
page: page,
});
if (issues.length === 0) break;
allIssues = allIssues.concat(issues);
page++;
}

for (const issue of allIssues) {
// Skip PRs (they show up in the issues API)
if (issue.pull_request) continue;

// Skip unassigned
if (!issue.assignees || issue.assignees.length === 0) continue;

const labels = issue.labels.map(l => l.name);

// Skip protected issues
if (SKIP_LABELS.some(skip => labels.includes(skip))) {
console.log(`#${issue.number}: skipped (protected)`);
continue;
}

const updatedAt = new Date(issue.updated_at);
const daysSinceUpdate = Math.floor((now - updatedAt) / (1000 * 60 * 60 * 24));
const assigneeLogins = issue.assignees.map(a => a.login);

// 21+ days -> unassign and add help wanted
if (daysSinceUpdate >= UNASSIGN_DAYS) {
const names = assigneeLogins.map(l => `@${l}`).join(', ');

console.log(`#${issue.number}: unassigning ${names} (${daysSinceUpdate} days)`);

const unassignMsg = [
`Removing assignment from ${names} after ${daysSinceUpdate} days of inactivity`,
'(per the [assignment policy](../blob/main/CONTRIBUTING.rst#issue-assignment-policy)).',
'',
'Feel free to comment if you want to pick this back up or if someone else wants to take it.',
].join('\n');

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: unassignMsg,
});

await github.rest.issues.removeAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
assignees: assigneeLogins,
});

if (!labels.includes('help wanted')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['help wanted'],
});
}

continue;
}

// 14+ days -> warn
if (daysSinceUpdate >= WARN_DAYS) {
// Check if we already warned (avoid spamming)
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
per_page: 5,
});

const recentWarn = comments.some(c =>
c.user.login === 'github-actions[bot]' &&
c.body.includes('assignment policy') &&
(now - new Date(c.created_at)) / (1000 * 60 * 60 * 24) < 10
);

if (recentWarn) {
console.log(`#${issue.number}: skipped (already warned recently)`);
continue;
}

const names = assigneeLogins.map(l => `@${l}`).join(', ');

console.log(`#${issue.number}: warning ${names} (${daysSinceUpdate} days)`);

const warnMsg = [
`${names}, this issue has been inactive for ${daysSinceUpdate} days.`,
'Are you still working on it? Drop a comment to let us know.',
'',
'If there is no update within 7 days, the assignment will be removed',
'so someone else can pick it up',
'(per the [assignment policy](../blob/main/CONTRIBUTING.rst#issue-assignment-policy)).',
].join('\n');

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: warnMsg,
});
}
}
Loading
Loading