Skip to content

@PR • Labeler triggered by dilaouid on branch chore/analytics-contact-send-lwd #107306

@PR • Labeler triggered by dilaouid on branch chore/analytics-contact-send-lwd

@PR • Labeler triggered by dilaouid on branch chore/analytics-contact-send-lwd #107306

Workflow file for this run

name: "[CI] - Labeler - PR"

Check warning on line 1 in .github/workflows/labeler.yml

View workflow run for this annotation

GitHub Actions / [CI] - Labeler - PR

Workflow execution policy warning (evaluate mode)

Event 'pull_request_target' is not allowed to trigger Actions workflows.
run-name: "@PR • Labeler triggered by ${{ github.actor }} ${{ format('on branch {0}', github.head_ref) }}"
# pull_request_target is required for fork PR write access (label/fork tagging).
# No PR code is checked out, so the elevated token cannot execute attacker-controlled code.
on:
- pull_request_target # zizmor: ignore[dangerous-triggers]
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-22.04
steps:
- name: generate token
id: generate-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # 2.2.1
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
permission-pull-requests: write
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4
with:
repo-token: ${{ steps.generate-token.outputs.token }}
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
if: github.event.pull_request.head.repo.fork
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
try {
const { data: rawLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
}) || [];
const labels = rawLabels.map(label => label.name)
console.log(labels)
if(labels.includes('fork')) {
return
}
await github.rest.issues.setLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [...labels, 'fork']
})
} catch(error) {
console.error(error)
}