Skip to content

Commit

Permalink
Add script to automatically label dependabot prs (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
daogrady authored Dec 2, 2024
1 parent bdecc94 commit f638a0d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/dependabot-skip-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Label Dependabot PRs

on:
pull_request:
types: [opened]

jobs:
label_dependabot:
runs-on: ubuntu-latest
steps:
- name: Check if PR is by Dependabot
uses: actions/github-script@v7
with:
script: |
const prAuthor = context.payload.pull_request.user.login;
const prNumber = context.payload.pull_request.number;
const repoOwner = context.repo.owner;
const repoName = context.repo.repo;
if (prAuthor === 'dependabot[bot]' || prAuthor === 'dependabot') {
core.info(`PR #${prNumber} is authored by Dependabot. Adding label...`);
await github.rest.issues.addLabels({
owner: repoOwner,
repo: repoName,
issue_number: prNumber,
labels: ['skip changelog']
});
} else {
core.info(`PR #${prNumber} is not authored by Dependabot. No action taken.`);
}

0 comments on commit f638a0d

Please sign in to comment.