Giter VIP home page Giter VIP logo

action-update-dprint-plugins's Introduction

action-update-dprint-plugins

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

CI

GitHub Action to update dprint plugins in dprint.json

Usage

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 }}'

Preparation

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

Input Parameters

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

Outputs

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

Motivation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.