Add changelog label to merged PRs (#3664)

This commit is contained in:
jack1142 2020-03-26 13:56:10 +01:00 committed by GitHub
parent 287edb755d
commit 3d7ff7a149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,26 @@
name: Add changelog label to merged PR
on:
pull_request:
types: [closed]
jobs:
build:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- name: Apply label
uses: actions/github-script@0.4.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const is_changelog_label = (label) => label.name.startsWith('Changelog Entry: ');
if (context.payload.pull_request.labels.some(is_changelog_label)) {
console.log('Issue already has Changelog Entry label, skipping...');
return;
}
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Changelog Entry: Pending']
});