Skip to content

Commit

Permalink
enh(ci): workflow to add external label to forked pull requests (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret authored Dec 16, 2024
1 parent 66c82d6 commit f210197
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/set-pull-request-external-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: set-pull-request-external-label

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
pull_request_target:

jobs:
set-pull-request-external-label:
if: |
github.event.pull_request.head.repo.fork &&
! contains(github.event.pull_request.labels.*.name, 'external')
runs-on: ubuntu-24.04

steps:
- name: Set PR external label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const label = 'external';
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [label]
});
} catch (e) {
core.warning(`failed to add label ${label}: ${e}`);
}

0 comments on commit f210197

Please sign in to comment.