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
116 changes: 101 additions & 15 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,111 @@
# https://github.com/actions/labeler#common-examples
# File-based labels consumed by Release Drafter in .github/release-drafter.yml.
# Use existing repository labels; status and triage labels remain manual.

release-candidate:
- 'CHANGELOG.md'
documentation:
- changed-files:
- any-glob-to-any-file:
- 'docs/**'
- 'doxygen/**'
- '**/*.md'
- '**/*.rst'

submodules:
- any: ['src/deps/**']
ci:
- changed-files:
- any-glob-to-any-file:
- '.github/**'
- '.codecov.yml'
- '.readthedocs.yml'
- 'readthedocs-conda.yml'

github_actions:
- changed-files:
- any-glob-to-any-file:
- '.github/workflows/**'
- '.github/actions/**'
- '.github/scripts/**'
- '.github/dependabot.yml'
- '.github/labeler.yml'
- '.github/release-drafter.yml'

build:
- changed-files:
- any-glob-to-any-file:
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/*.cmake.in'
- 'Makefile'
- 'setup.py'
- 'setup.cfg'
- 'pyproject.toml'
- 'MANIFEST.in'

cmake:
- changed-files:
- any-glob-to-any-file:
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/*.cmake.in'

wheels:
- changed-files:
- any-glob-to-any-file:
- 'setup.py'
- 'setup.cfg'
- 'pyproject.toml'
- 'MANIFEST.in'
- '.github/workflows/python-package.yml'
- '.github/workflows/pypi-publish.yml'

dependencies:
- any: ['pyproject.toml']
- changed-files:
- any-glob-to-any-file:
- '.gitmodules'
- 'src/deps/**'
- 'pyproject.toml'
- '**/requirements*.txt'

ci:
- '.github/**'
submodules:
- changed-files:
- any-glob-to-any-file:
- '.gitmodules'
- 'src/deps/**'

documentation:
- any: ['docs/**']
python:
- changed-files:
- any-glob-to-any-file: '**/*.py'

python-bindings:
- changed-files:
- any-glob-to-any-file:
- 'src/py-opentimelineio/**'
- 'tests/test_cxx_sdk_bindings.py'

opentime:
- any: ['src/opentime/**']
- changed-files:
- any-glob-to-any-file:
- 'src/opentime/**'
- 'src/py-opentimelineio/opentime-bindings/**'
- 'tests/test_opentime.*'

'time calculations':
- any: ['src/opentime/**']
time calculations:
- changed-files:
- any-glob-to-any-file:
- 'src/opentime/**'
- 'src/py-opentimelineio/opentime-bindings/**'
- 'tests/test_opentime.*'

python-bindings:
- any: ['src/py-opentimelineio/**']
color:
- changed-files:
- any-glob-to-any-file:
- 'src/opentimelineio/color.*'
- 'src/py-opentimelineio/opentimelineio/core/color.py'
- 'tests/test_color.*'
- 'tests/baselines/empty_color.json'

maintenance:
- any:
- changed-files:
- any-glob-to-any-file: 'maintainers/**'
# A production change accompanied by tests is not automatically maintenance.
- changed-files:
- all-globs-to-all-files: 'tests/**'
82 changes: 21 additions & 61 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,67 +41,8 @@ tag-template: 'v$RESOLVED_VERSION'
# - 'docs'
# - 'style'

# automatically label pull requests
# https://github.com/release-drafter/release-drafter#autolabeler
autolabeler:
- label: 'feat'
title:
- '/^feat.+/'
branch:
- '/feature\/.+/'
- '/feat\/.+/'
- label: 'fix'
title:
- '/^fix.+/'
branch:
- '/bugfix\/.+/'
- '/hotfix\/.+/'
- '/fix\/.+/'
- label: 'build'
title:
- '/^build.+/'
branch:
- '/build\/.+/'
- label: 'chore'
title:
- '/^chore.+/'
branch:
- '/chore\/.+/'
- label: 'ci'
title:
- '/^ci.+/'
branch:
- '/ci\/.+/'
- label: 'documentation'
title:
- '/^docs.+/'
branch:
- '/docs\/.+/'
- label: 'perf'
title:
- '/^perf.+/'
branch:
- '/perf\/.+/'
- label: 'refactor'
title:
- '/^refactor.+/'
branch:
- '/refactor\/.+/'
- label: 'revert'
title:
- '/^revert.+/'
branch:
- '/revert\/.+/'
- label: 'style'
title:
- '/^style.+/'
branch:
- '/style\/.+/'
- label: 'test'
title:
- '/^test.+/'
branch:
- '/test\/.+/'
# Automatic file labels are configured in .github/labeler.yml.
# Release Preview runs the drafter, not its separate autolabeler action.

# Categorize pull requests using labels
# https://github.com/release-drafter/release-drafter#categorize-pull-requests
Expand All @@ -110,6 +51,7 @@ categories:
labels:
- 'feat'
- 'feature'
- 'enhancement'
- 'perf'
- title: '📖 Documentation'
labels:
Expand All @@ -119,11 +61,29 @@ categories:
- 'bug'
- 'bugfix'
- 'fix'
- title: '🐍 Python & Bindings'
labels:
- 'python'
- 'python-bindings'
- 'language support'
- title: '⏱️ Time'
labels:
- 'opentime'
- 'time calculations'
- 'frame rates'
- title: '🎨 Color'
labels:
- 'color'
- title: '🧰 Maintenance'
labels:
- 'build'
- 'cmake'
- 'maintenance'
- 'chore'
- 'dependencies'
- 'submodules'
- 'github_actions'
- 'wheels'
- 'ci'
- 'refactor'
- 'revert'
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request Label Signal

on:
pull_request:
types: [opened, reopened, synchronize, edited, ready_for_review]

# This workflow only signals that PR metadata changed. It needs no token
# permissions, checkout, secrets, caches, or artifacts, including for forks.
permissions: {}

jobs:
signal:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- run: echo 'Pull request metadata changed.'
94 changes: 94 additions & 0 deletions .github/workflows/pr-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Pull Request Tools

on:
workflow_run:
workflows: [Pull Request Label Signal]
types: [completed]
workflow_dispatch:
inputs:
pull-request:
description: 'PR number to label (open or merged)'
type: string
required: true

permissions: {}

jobs:
label:
if: >-
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
(github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.path == '.github/workflows/pr-labels.yml' &&
github.event.workflow_run.repository.id == github.event.repository.id))
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
steps:
# No checkout, artifacts, or caches: PR metadata is data, never code.
- name: Find current pull requests
id: prs
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const repository = context.payload.repository;
let candidates;
const manual = context.eventName === 'workflow_dispatch';
const headSha = context.payload.workflow_run?.head_sha;
if (manual) {
const input = context.payload.inputs['pull-request'];
if (!/^[1-9][0-9]*$/.test(input) || !Number.isSafeInteger(Number(input))) {
throw new Error('Expected a positive integer PR number');
}
candidates = [{number: Number(input)}];
} else {
if (!/^[0-9a-f]{40}$/.test(headSha ?? '')) {
throw new Error('Invalid head SHA in labeling signal');
}
// Fork runs may have no workflow_run.pull_requests association.
candidates = (await github.paginate(github.rest.pulls.list, {
...context.repo, state: 'open', per_page: 100,
})).filter(pr => pr.head.sha === headSha);
}
const numbers = [];
for (const candidate of candidates) {
const {data: pr} = await github.rest.pulls.get({
...context.repo, pull_number: candidate.number,
});
if (pr.base.repo.id !== repository.id ||
!(pr.state === 'open' || (manual && pr.merged_at)) ||
(!manual && pr.head.sha !== headSha)) continue;
// GitHub's files endpoint cannot return more than 3,000 files.
if (pr.changed_files > 3000) {
core.warning(`Skipping PR #${pr.number}: file list would be incomplete`);
continue;
}
numbers.push(pr.number);
}
core.setOutput('numbers', numbers.join('\n'));
if (numbers.length) {
// This labeler commit double-encodes slashes in remote config
// paths. Fetch only the trusted YAML using a literal API path.
const {data} = await github.request(
'GET /repos/{owner}/{repo}/contents/.github/labeler.yml',
{...context.repo, ref: context.sha},
);
require('node:fs').writeFileSync(
require('node:path').join(process.env.RUNNER_TEMP, 'otio-labeler.yml'),
Buffer.from(data.content, 'base64'),
);
}

- name: Apply file labels incrementally
if: steps.prs.outputs.numbers != ''
# Post-v7.0.0 fix: selective additions/removals preserve other labels.
# https://github.com/actions/labeler/pull/957
uses: actions/labeler@b7a88044754812b108a54feec878dd5c328bba59
with:
pr-number: ${{ steps.prs.outputs.numbers }}
configuration-path: ${{ runner.temp }}/otio-labeler.yml
sync-labels: true
dot: true
Loading
Loading