Deprecated: This repositoy is archived
I do NOT recommend to use this action now, because some updating will not work.
See #6 (comment) for further detail
GitHub Action to update dprint plugins in dprint.json
An example workflow in your repository, assuming it is named .github/workflows/dprint-update-plugin.yml
.
name: Update dprint plugins
on:
push:
branches: ['main']
paths:
- '.github/workflows/dprint-update-plugin.yml'
schedule:
# Run at 17:00 UTC every Monday
- cron: '0 17 * * 1'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
pull-requests: write
# Allow one concurrent dprint updater
concurrency:
group: 'update-dprint'
cancel-in-progress: true
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- id: update-dprint-plugins
uses: kachick/[email protected]
with:
base-branch: 'main'
dprint-version: '0.40.1'
# Enable `Allow auto-merge` in your repository settings if you need following steps
- name: Merge sent PR
# Checking `dprint fmt` did not make any diff even after updating plugins
if: ${{ steps.update-dprint-plugins.outputs.pr_url != '' && steps.update-dprint-plugins.outputs.fmt == 'false' }}
run: gh pr merge --auto --squash --delete-branch "${{ steps.update-dprint-plugins.outputs.pr_url }}"
env:
# Need to be replaced to your PAT if need to approve or need to trigger other actions
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
Need to add following permissions if you use GITHUB_TOKEN
permissions:
contents: write
pull-requests: write
Enable the following options in your repository settings
- Enable
Allow GitHub Actions to create and approve pull requests
- Enable
Allow auto-merge
if you need auto merging
All options should be specified with string. So true/false should be 'true'/'false'
name | default | options | description |
---|---|---|---|
base-branch | (null) | e.g 'main' | The branch into which you want updating PR merged |
github-token | ${{ github.token }} | e.g '${{ secrets.YOUR_PAT }}' | The token will be used to create PR |
dprint-version | (null) | e.g '0.40.1' | Specific dprint version to use. Should be specified |
config-path | 'dprint.json' | e.g 'dprint-ci.json' | Specific dprint config to use |
fmt | false | true/false | Run fmt and outputs the result in outputs.fmt if enabled. It may fail from some reasons |
name | patterns | description |
---|---|---|
pr_url | e.g. 'https://github.com/owner/repos/pull/42 ' |
Sent PR URL |
fmt | true/false | Return true if diff was made in dprint fmt after updating plugins. Can be used only in fmt in inputs is enabled |
- A solution with renovatebot is here, but it may not update some plugins like dprint-plugin-prettier