From cd25fc706d52703669a657e6cdbfa51d637882fd Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Fri, 3 Apr 2026 20:03:16 -0700 Subject: [PATCH] Add Dependabot PR title workflow; tweak templates --- .github/dependabot.yml | 4 --- .github/workflows/dependabot-pr-title.yml | 30 +++++++++++++++++++++++ cliff.toml | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/dependabot-pr-title.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 79a2bba..3112716 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,8 +7,6 @@ updates: interval: "weekly" labels: - "dependencies" - commit-message: - prefix: "build(deps)" # Maintain GitHub Actions in your workflows - package-ecosystem: "github-actions" @@ -18,5 +16,3 @@ updates: labels: - "dependencies" - "ci" - commit-message: - prefix: "ci(github-actions)" \ No newline at end of file diff --git a/.github/workflows/dependabot-pr-title.yml b/.github/workflows/dependabot-pr-title.yml new file mode 100644 index 0000000..58b73a7 --- /dev/null +++ b/.github/workflows/dependabot-pr-title.yml @@ -0,0 +1,30 @@ +name: Dependabot PR Title + +on: + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + pull-requests: write + +jobs: + prefix-title: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Update PR Title + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + # Check if it already has a prefix to prevent double-prefixing + if [[ "$PR_TITLE" != build\(deps\)* ]] && [[ "$PR_TITLE" != ci\(github-actions\)* ]]; then + # If it's a GitHub Action update, use ci(github-actions) + if [[ "$PR_TITLE" == *"github-actions"* || "$PR_TITLE" == *"actions/"* ]]; then + gh pr edit "$PR_URL" --title "ci(github-actions): $PR_TITLE" + else + # Otherwise, use build(deps) for Go modules + gh pr edit "$PR_URL" --title "build(deps): $PR_TITLE" + fi + fi diff --git a/cliff.toml b/cliff.toml index 3748d39..a1b5e56 100644 --- a/cliff.toml +++ b/cliff.toml @@ -11,7 +11,7 @@ body = """ {% set commit_title = commit_title | replace(from=pr_str, to="") -%} {% endif -%} - {% if commit.breaking %}[breaking] {% endif %}{{ commit_title | upper_first }}\ -{% if commit.remote.username %} by @{{ commit.remote.username }}{% endif %}\ +{% if commit.author.name %} by **{{ commit.author.name }}**{% endif %}\ {% if commit.remote.pr_number %} in [#{{ commit.remote.pr_number }}](https://github.com/DylanDevelops/tmpo/pull/{{ commit.remote.pr_number }}){% endif %} {% endfor %}