mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-03 13:52:06 +03:00
feat: add workflow to auto update i18n json
This commit is contained in:
parent
41174c74d7
commit
ad73c41483
89
.github/workflows/languages-download.yml.bak
vendored
Normal file
89
.github/workflows/languages-download.yml.bak
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
name: Download Languages Resources
|
||||
|
||||
on:
|
||||
# schedule:
|
||||
# - cron: "0 0 * * 5" # At 00:00(UTC) on Friday.
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for
|
||||
# pull requests or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# This action need write permission to create pull requests
|
||||
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
main:
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Use pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
# https://github.com/actions/setup-node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install node modules
|
||||
run: pnpm install
|
||||
|
||||
- name: Sync Languages
|
||||
working-directory: ./packages/i18n
|
||||
run: pnpm run download-resources
|
||||
env:
|
||||
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
|
||||
|
||||
- name: Push Branch
|
||||
id: push
|
||||
run: |
|
||||
git add packages/i18n
|
||||
# Do not proceed if there are no file differences
|
||||
COMMIT=$(git rev-parse --verify origin/$TARGET_BRANCH || echo HEAD)
|
||||
FILES_CHANGED=$(git diff-index --name-only --cached $COMMIT | wc -l)
|
||||
if [[ "$FILES_CHANGED" = "0" ]]; then
|
||||
echo "No file changes detected."
|
||||
echo "::set-output name=skipPR::true"
|
||||
exit 0
|
||||
fi
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git commit --message 'feat(i18n): new translations' --no-verify
|
||||
git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY"
|
||||
git push --force origin HEAD:$TARGET_BRANCH
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TARGET_BRANCH: bot/new-translations
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
||||
|
||||
# see https://github.com/repo-sync/pull-request
|
||||
- name: Create Pull Request
|
||||
if: steps.push.outputs.skipPR != 'true'
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
source_branch: 'bot/new-translations' # If blank, default: triggered branch
|
||||
destination_branch: "master"
|
||||
pr_title: Update i18n (${{ steps.date.outputs.date }}) # Title of pull request
|
||||
pr_label: 'data,bot' # Comma-separated list (no spaces)
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
63
.github/workflows/languages-sync.yml.bak
vendored
Normal file
63
.github/workflows/languages-sync.yml.bak
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
name: Languages Sync
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [ "feat/sync-languages" ]
|
||||
# paths:
|
||||
# - 'packages/i18n/**'
|
||||
# - '.github/workflows/languages-sync.yml'
|
||||
# pull_request:
|
||||
# branches: [ "feat/sync-languages" ]
|
||||
# paths:
|
||||
# - 'packages/i18n/**'
|
||||
# - '.github/workflows/languages-sync.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for
|
||||
# pull requests or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Use pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
# https://github.com/actions/setup-node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install node modules
|
||||
run: pnpm install
|
||||
|
||||
- name: Check Language Key
|
||||
if: github.ref != 'feat/sync-languages'
|
||||
working-directory: ./packages/i18n
|
||||
run: pnpm run sync-languages:check
|
||||
env:
|
||||
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
|
||||
|
||||
- name: Sync Languages
|
||||
if: github.ref == 'feat/sync-languages'
|
||||
working-directory: ./packages/i18n
|
||||
run: pnpm run sync-languages
|
||||
env:
|
||||
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
|
@ -141,5 +141,6 @@
|
||||
"Sign in": "Sign in to AFFiNE Cloud",
|
||||
"Sync Description": "{{workspaceName}} is a Local Workspace. All data is stored on the current device. You can enable AFFiNE Cloud for this workspace to keep data in sync with the cloud.",
|
||||
"Sync Description2": "<1>{{workspaceName}}</1> is a Cloud Workspace. All data will be synchronised and saved to AFFiNE Cloud.",
|
||||
"Delete Workspace Description": "Deleting (<1>{{workspace}}</1>) cannot be undone, please proceed with caution. All contents will be lost."
|
||||
"Delete Workspace Description": "Deleting (<1>{{workspace}}</1>) cannot be undone, please proceed with caution. All contents will be lost.",
|
||||
"test auto update": "test"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user