feat: optimize actions

This commit is contained in:
源文雨 2023-09-21 23:47:31 +09:00
parent f33f18cb0a
commit 0f34027cca
3 changed files with 22 additions and 29 deletions

View File

@ -6,11 +6,9 @@ on:
- dev - dev
jobs: jobs:
genlocale: genlocale:
name: genlocale
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out - uses: actions/checkout@master
uses: actions/checkout@master
- name: Run locale generation - name: Run locale generation
run: | run: |
@ -20,15 +18,22 @@ jobs:
- name: Commit back - name: Commit back
if: ${{ !github.head_ref }} if: ${{ !github.head_ref }}
id: commitback
continue-on-error: true continue-on-error: true
run: | run: |
git config --local user.name 'github-actions[bot]' git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com' git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git add --all git add --all
git commit -m "🎨 同步 locale" git commit -m "chore(i18n): sync locale"
- name: Create Pull Request - name: Create Pull Request
if: ${{ !github.head_ref }} if: steps.commitback.outcome == 'success'
continue-on-error: true 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

View File

@ -6,8 +6,7 @@ on:
jobs: jobs:
# This workflow closes invalid PR # This workflow closes invalid PR
close-pr: close_pr:
name: closepr
# The type of runner that the job will run on # The type of runner that the job will run on
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: write-all permissions: write-all
@ -22,20 +21,14 @@ jobs:
comment: "Invalid PR to non-dev branch ${{ github.event.pull_request.base.ref }}." comment: "Invalid PR to non-dev branch ${{ github.event.pull_request.base.ref }}."
pull_format: pull_format:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
strategy:
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
fail-fast: false
continue-on-error: true continue-on-error: true
steps: steps:
- name: checkout - name: Checkout
continue-on-error: true continue-on-error: true
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:

View File

@ -12,14 +12,7 @@ permissions:
jobs: jobs:
push_format: push_format:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -44,7 +37,7 @@ jobs:
git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
git add --all git add --all
git commit -m "Format code" git commit -m "chore(format): run black"
- name: Create Pull Request - name: Create Pull Request
if: steps.commitback.outcome == 'success' if: steps.commitback.outcome == 'success'
@ -52,6 +45,8 @@ jobs:
uses: peter-evans/create-pull-request@v5 uses: peter-evans/create-pull-request@v5
with: with:
delete-branch: true delete-branch: true
body: Apply Code Formatter Change body: "Automatically apply code formatter change"
title: Apply Code Formatter Change title: "chore(format): run black"
commit-message: Automatic code format commit-message: "chore(format): run black"
branch: formatter-${{github.ref_name}}
branch-suffix: short-commit-hash