Skip to content

Commit

Permalink
chore: Automatically upgrade workflow dependencies (#48)
Browse files Browse the repository at this point in the history
Configures Dependabot to automatically upgrade outdated workflow
dependencies, and adds automation for pull request labelling based on
commit message prefixes.
  • Loading branch information
unfunco authored Feb 5, 2024
1 parent cb4b7c9 commit be2be58
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2

updates:
- package-ecosystem: github-actions
commit-message:
prefix: chore
prefix-development: chore
directory: "/"
labels:
- chore 🧹
- workflows 👷‍♀️
pull-request-branch-name:
separator: /
reviewers:
- unfunco
schedule:
day: sunday
interval: weekly
3 changes: 3 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"workflows 👷‍♀️":
- changed-files:
- any-glob-to-any-file: .github/**/*.yaml
42 changes: 42 additions & 0 deletions .github/workflows/pr_label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR / Label

on:
pull_request_target: { }

jobs:
triage:
name: Triage
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Apply context labels
uses: actions/labeler@v5
with:
configuration-path: .github/labeler.yaml
sync-labels: true
- name: Apply commit message labels
uses: actions/github-script@v7
with:
script: |
const labels = []
if (context.payload.pull_request.title.startsWith('fix:')) {
labels.push('bug 🐛')
}
if (context.payload.pull_request.title.startsWith('chore:')) {
labels.push('chore 🧹')
}
if (context.payload.pull_request.title.startsWith('feat:')) {
labels.push('feature 💡')
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
labels,
owner: context.repo.owner,
repo: context.repo.repo,
})
}

0 comments on commit be2be58

Please sign in to comment.