自动通过 TinyPNG 优化图片

发布于 2022-04-06  910 次阅读


创建 GitHub Action 动作并复制以下命令

name: image
on:
  pull_request:
    paths:
      - 'static/**'
jobs:
  compress:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
      - uses: namoscato/action-tinify@v1
        with:
          api_key: ${{ secrets.TINIFY_API_KEY }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
input description
api_key Tinify API key (create one here)
github_token GITHUB_TOKEN秘密

山东财经大学曹永卓,热爱编程,热爱金融。考研加油,一定要上岸!!!