Skip to content

Commit

Permalink
ci(dependabot): auto dependabot PR-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dschach committed Nov 8, 2023
1 parent 1c028e6 commit 8410643
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 71 deletions.
10 changes: 6 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
commit-message:
prefix: 'build'
include: 'scope'
prefix: 'deps' # packaged dependencies
prefix-development: 'build' # dev-dependencies
#include: 'scope'
rebase-strategy: 'auto'
schedule:
interval: 'daily'
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/' # Location of package manifests
commit-message:
prefix: 'ci'
include: 'scope'
#prefix: 'ci'
prefix: 'ci(github-actions)'
#include: 'scope'
rebase-strategy: 'auto'
schedule:
interval: 'daily'
36 changes: 35 additions & 1 deletion .github/workflows/dependabot-approve-and-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
name: Dependabot Pull Request Approve and Merge
on: pull_request_target
on: pull_request #_target
permissions:
pull-requests: write
contents: write
jobs:
pull-request-title-change:
runs-on: ubuntu-latest
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4

- name: 'Fetch Dependabot metadata'
id: dependabot-fetch
uses: dependabot/fetch-metadata@v1

- name: 'Split title and update'
id: split-title
if: ${{ ! contains(github.event.pull_request.title, '):' ) && contains(github.event.pull_request.title, ':') && steps.dependabot-fetch.outcome == 'success' }}
env:
TITLE: ${{ github.event.pull_request.title }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{github.event.pull_request.html_url}}
run: |
echo $TITLE
title_pt2="${TITLE##*:}"
title_pt1="${TITLE%%:*}"
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
packagename="${{ steps.dependabot-fetch.outputs.dependency-names }}"
echo "packagename is $packagename"
echo "$title_pt1"
echo "$title_pt2"
parensOpen="("
parensClose="):"
pr_title=$title_pt1$parensOpen$packagename$parensClose$title_pt2
echo "FINAL TITLE: $pr_title"
gh pr edit "$PR_URL" --title "$pr_title"
# Auto merge Dependabot PRs for:
# - patch updates on prod dependencies
# - minor updates on dev dependencies
dependabot-auto-merge:
needs: pull-request-title-change
# Only run for Dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"files": "*.{cmp,page,component}",
"options": { "parser": "html" }
},
{
"files": ".json",
"options": { "parser": "json", "printWidth": 80 }
},
{
"files": "*.{yaml,yml}",
"options": { "useTabs": false, "tabWidth": 2, "singleQuote": true }
Expand Down
80 changes: 14 additions & 66 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,21 @@
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"extra-files": [
{
"type": "json",
"path": "package.json",
"jsonpath": "$.version"
}
],
"plugins": [
{
"type": "sentence-case"
}
{ "type": "json", "path": "package.json", "jsonpath": "$.version" }
],
"plugins": [{ "type": "sentence-case" }],
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
},

{
"type": "ci",
"section": "Continuous Integration",
"hidden": false
},
{
"type": "revert",
"section": "Reverts",
"hidden": false
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "style",
"section": "Styles",
"hidden": false
},
{
"type": "build",
"section": "Build System",
"hidden": true
}
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "chore", "section": "Chores", "hidden": false },
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "test", "section": "Tests", "hidden": false },
{ "type": "revert", "section": "Reverts", "hidden": false },
{ "type": "refactor", "section": "Code Refactoring", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": false },
{ "type": "deps", "section": "Dependencies", "hidden": false },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": false }
]
}

0 comments on commit 8410643

Please sign in to comment.