mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: Auto Label PR
|
|
|
|
on:
|
|
# Runs only on pull_request_target due to having access to a App token.
|
|
# This means PRs from forks will not be able to alter this workflow to get the tokens
|
|
pull_request_target:
|
|
types: [labeled, opened, reopened, synchronize, edited]
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|
|
env:
|
|
SMALL_PR_THRESHOLD: 30
|
|
MAX_LABELS: 15
|
|
TOO_BIG_THRESHOLD: 1000
|
|
COMPONENT_LABEL_THRESHOLD: 10
|
|
|
|
jobs:
|
|
label:
|
|
runs-on: ubuntu-latest
|
|
if: github.event.action != 'labeled' || github.event.sender.type != 'Bot'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Generate a token
|
|
id: generate-token
|
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
|
|
with:
|
|
app-id: ${{ secrets.ESPHOME_GITHUB_APP_ID }}
|
|
private-key: ${{ secrets.ESPHOME_GITHUB_APP_PRIVATE_KEY }}
|
|
|
|
- name: Auto Label PR
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ steps.generate-token.outputs.token }}
|
|
script: |
|
|
const script = require('./.github/scripts/auto-label-pr/index.js');
|
|
await script({ github, context });
|