From 0f34027ccacb2069608673fb396cf66d0e337c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:47:31 +0900 Subject: [PATCH] feat: optimize actions --- .github/workflows/genlocale.yml | 19 ++++++++++++------- .github/workflows/pull_format.yml | 13 +++---------- .github/workflows/push_format.yml | 19 +++++++------------ 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/.github/workflows/genlocale.yml b/.github/workflows/genlocale.yml index 7a7bf0f..7ec5ada 100644 --- a/.github/workflows/genlocale.yml +++ b/.github/workflows/genlocale.yml @@ -6,11 +6,9 @@ on: - dev jobs: genlocale: - name: genlocale runs-on: ubuntu-latest steps: - - name: Check out - uses: actions/checkout@master + - uses: actions/checkout@master - name: Run locale generation run: | @@ -20,15 +18,22 @@ jobs: - name: Commit back if: ${{ !github.head_ref }} + id: commitback continue-on-error: true run: | git config --local user.name 'github-actions[bot]' git config --local user.email 'github-actions[bot]@users.noreply.github.com' git add --all - git commit -m "🎨 同步 locale" + git commit -m "chore(i18n): sync locale" - name: Create Pull Request - if: ${{ !github.head_ref }} + if: steps.commitback.outcome == 'success' continue-on-error: true - uses: peter-evans/create-pull-request@v4 - + uses: peter-evans/create-pull-request@v5 + with: + delete-branch: true + body: "Automatically sync i18n translation jsons" + title: "chore(i18n): sync locale" + commit-message: "chore(i18n): sync locale" + branch: genlocale-${{github.ref_name}} + branch-suffix: short-commit-hash diff --git a/.github/workflows/pull_format.yml b/.github/workflows/pull_format.yml index e0d5ddf..d669de5 100644 --- a/.github/workflows/pull_format.yml +++ b/.github/workflows/pull_format.yml @@ -6,8 +6,7 @@ on: jobs: # This workflow closes invalid PR - close-pr: - name: closepr + close_pr: # The type of runner that the job will run on runs-on: ubuntu-latest permissions: write-all @@ -22,20 +21,14 @@ jobs: comment: "Invalid PR to non-dev branch ${{ github.event.pull_request.base.ref }}." pull_format: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest permissions: contents: write - strategy: - matrix: - python-version: ["3.10"] - os: [ubuntu-latest] - fail-fast: false - continue-on-error: true steps: - - name: checkout + - name: Checkout continue-on-error: true uses: actions/checkout@v3 with: diff --git a/.github/workflows/push_format.yml b/.github/workflows/push_format.yml index 19011d3..a95c3bf 100644 --- a/.github/workflows/push_format.yml +++ b/.github/workflows/push_format.yml @@ -12,14 +12,7 @@ permissions: jobs: push_format: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - python-version: ["3.10"] - os: [ubuntu-latest] - fail-fast: false - + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: @@ -44,7 +37,7 @@ jobs: git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add --all - git commit -m "Format code" + git commit -m "chore(format): run black" - name: Create Pull Request if: steps.commitback.outcome == 'success' @@ -52,6 +45,8 @@ jobs: uses: peter-evans/create-pull-request@v5 with: delete-branch: true - body: Apply Code Formatter Change - title: Apply Code Formatter Change - commit-message: Automatic code format + body: "Automatically apply code formatter change" + title: "chore(format): run black" + commit-message: "chore(format): run black" + branch: formatter-${{github.ref_name}} + branch-suffix: short-commit-hash