diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..b617d82c2 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,60 @@ +# Area labels for pull requests, set from the paths a pull request changes (.github/workflows/labeler.yml runs +# actions/labeler on this file). A pull request can carry several labels; the labels already on it are never removed. +# The labels have to exist in the repository first: the action does not create them with a colour or description. + +'area: d3d12': + - changed-files: + - any-glob-to-any-file: ['d3d12/**'] + +# The RDNA2 -> SPIR-V translator: the Python tools, their regression suite and the Rust shader crate. +'area: shader translator': + - changed-files: + - any-glob-to-any-file: + - 'd3d12/crates/leonida-shader/**' + - 'tools/rdna2*.py' + - 'tools/spirv_*.py' + - 'tools/shader_*.py' + - 'tools/shader_carve_native/**' + - 'tools/fssm_*.py' + - 'tools/isa_coverage.py' + - 'tools/pe_shader_containers.py' + - 'tests/semantic/**' + +'area: launcher': + - changed-files: + - any-glob-to-any-file: ['launcher/**'] + +'area: runtime (legacy)': + - changed-files: + - any-glob-to-any-file: ['runtime/**'] + +'area: tools': + - changed-files: + - any-glob-to-any-file: ['tools/**', 'scripts/**'] + +'area: viewer': + - changed-files: + - any-glob-to-any-file: ['viewer/**'] + +'area: docs': + - changed-files: + - any-glob-to-any-file: ['docs/**', '**/*.md'] + +'area: ci': + - changed-files: + - any-glob-to-any-file: ['.github/**'] + +# A change the in-game gate (docs/game_gate.md) has to cover: the code a frame runs through, or the play scripts' +# defaults. all-globs-to-any-file needs ONE file to match every glob, so the three crates share one brace glob and +# the exclusions keep a change that only touches unit tests (tests.rs, *_tests.rs, tests/) from asking for a 300 s +# run. Top-level match objects are AND-ed, so the two rules sit under one `any`. +'needs in-game run': + - any: + - changed-files: + - all-globs-to-any-file: + - 'd3d12/crates/{leonida-gpu,leonida-shader,leonida-hle}/src/**' + - '!**/tests.rs' + - '!**/*_tests.rs' + - '!**/tests/**' + - changed-files: + - any-glob-to-any-file: ['d3d12/scripts/play*.ps1'] diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 000000000..37e94fc76 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,34 @@ +name: Area labels + +# Adds the area labels of .github/labeler.yml (and `needs in-game run`, the render change that docs/game_gate.md asks +# a run in the game for) to a pull request from the paths it changes. It only adds labels: a label a person set stays, +# and one the paths no longer match stays too (sync-labels is off). +# +# pull_request_target runs this file from main with a token that can write to pull requests, which is what lets it +# label a pull request from a fork. That is only safe because the job never checks out or runs pull request code: +# there is no checkout step, the action reads .github/labeler.yml from main through the API and the list of changed +# files from the API, and nothing here uses the pull request's branch, title or body. Keep it that way. +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: {} + +concurrency: + # A newer push to the same pull request replaces the run in progress; each run labels from the full file list. + group: labeler-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + label: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 + with: + repo-token: ${{ github.token }} + configuration-path: .github/labeler.yml + sync-labels: false