Skip to content

chore: automate dprint plugin updates via weekly scheduled workflow #236

Closed

Description

@EVWorth

Goal

Pin the existing dprint plugin manifest to a weekly cron job that runs dprint config update, diffs the change, and auto-opens a PR if anything in dprint.json moved.

Why

dprint plugins currently require manual bumping whenever a plugin publishes a release. Today's plugin set:

typescript: 0.93.3 -> 0.96.1 (last bumped manually in #235)
json:       0.20.0 -> 0.23.0 (last bumped manually in #235)
markdown:   0.18.0 -> 0.22.1 (last bumped manually in #235)
yaml:       added in #235 (g-plane/pretty_yaml-v0.6.0)
toml:       0.6.2  -> 0.7.0  (last bumped manually in #235)

Each plugin has its own release cadence (https://plugins.dprint.dev/ exposes latestVersions JSON), and dprint itself prints plugin version warnings on every run. Manual-bump is easy to forget; PR #235 only happened because someone (me) was poking around for a different reason.

Tool landscape

  • dprint config update -y — dprint's built-in command that walks the plugin manifest and rewrites it to current versions. Non-interactive with -y. Output is a deterministic diff of dprint.json if anything moved; no-op otherwise.
  • dprint add <name> / dprint add <gh-org>/<gh-repo> — for adding NEW plugins (out of scope for this issue; we don't auto-add, just auto-bump what we already have).
  • No Dependabot equivalent for dprint: GitHub Dependabot doesn't manage dprint.json plugin URLs.
  • Renovate has a dprint manager but the team isn't using Renovate today; adding it just for this would be heavier than writing the workflow.

Proposed implementation (~30 lines of yaml in a new workflow)

# .github/workflows/dprint-update.yml
name: dprint Plugin Updates
on:
  schedule:
    # Mondays 09:00 UTC
    - cron: "0 9 * * 1"
  workflow_dispatch:  # manual run for testing

jobs:
  bump:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Install dprint
        run: curl -fsSL https://dprint.dev/install.sh | sh
      - name: Run dprint config update
        run: dprint config update -y
      - name: Check for changes
        id: diff
        run: |
          if git diff --quiet dprint.json; then
            echo "changed=false" >> \$GITHUB_OUTPUT
          else
            echo "changed=true" >> \$GITHUB_OUTPUT
          fi
      - name: Open PR if plugins drifted
        if: steps.diff.outputs.changed == 'true'
        uses: peter-evans/create-pull-request@v6
        with:
          title: 'chore(deps): bump dprint plugins'
          commit-message: 'chore(deps): bump dprint plugins via dprint config update'
          branch: chore/dprint-plugin-update
          delete-branch: true

Acceptance criteria

  • .github/workflows/dprint-update.yml exists; weekly cron + manual dispatch both work.
  • When dprint config update makes no change to dprint.json, the workflow run ends with status "success, no PR" (no PR opened, no spam).
  • When the plugin manifest moves, a PR is opened titled chore(deps): bump dprint plugins with the diff committed and the body listing from→to versions.
  • Workflow runs in <2 minutes (the install + config update steps are the bulk).
  • Permissions scoped to contents: write + pull-requests: write only on the workflow itself, not on the broader CI token.

Operational notes

  • The cron runs after Dependabot (cooldown: { default-days: 7 }) makes its own bumps, so the two bots don't fight. dprint updates arrive ~1 day after the npm group updates.
  • The branch name chore/dprint-plugin-update collides if two runs land on the same day. Either increment suffix in PR title or use create-pull-request-action with a unique-per-run branch like chore/dprint-update-\${{ github.run_id }}.
  • If dprint later adds config lock (a feature under discussion per dprint issue tracker), this workflow becomes a no-op once. Revisit then.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesenhancementgithub-actions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions