From 66d5f3e4b5d529eec673cfb256f52d875bb7c38c Mon Sep 17 00:00:00 2001 From: Ludy Date: Tue, 9 Apr 2024 00:33:58 +0200 Subject: [PATCH] add sync-readme (#1051) --- .github/workflows/sync_files.yml | 87 +++++++++++++++++++++++++++++ .github/workflows/sync_versions.yml | 51 ----------------- 2 files changed, 87 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/sync_files.yml delete mode 100644 .github/workflows/sync_versions.yml diff --git a/.github/workflows/sync_files.yml b/.github/workflows/sync_files.yml new file mode 100644 index 00000000..eba5a019 --- /dev/null +++ b/.github/workflows/sync_files.yml @@ -0,0 +1,87 @@ +name: Sync Files + +on: + push: + branches: + - main + paths: + - "build.gradle" + - "src/main/resources/messages_*.properties" + +permissions: + contents: write + pull-requests: write + +jobs: + sync-versions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: "3.x" + - name: Install dependencies + run: pip install pyyaml + - name: Sync versions + run: python .github/scripts/gradle_to_chart.py + - name: Set up git config + run: | + git config --global user.email "GitHub Action " + git config --global user.name "GitHub Action " + - name: Run git add + run: | + git add . + git diff --staged --quiet || git commit -m ":floppy_disk: Sync Versions + > Made via sync_files.yml" || echo "no changes" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update files + committer: GitHub Action + author: GitHub Action + signoff: true + branch: sync_version + title: ":floppy_disk: Update Version" + body: | + Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request + draft: false + delete-branch: true + sync-readme: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: "3.x" + - name: Sync README + run: python scripts/counter_translation.py + - name: Set up git config + run: | + git config --global user.email "GitHub Action " + git config --global user.name "GitHub Action " + - name: Run git add + run: | + git add . + git diff --staged --quiet || git commit -m ":memo: Sync README + > Made via sync_files.yml" || echo "no changes" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update files + committer: GitHub Action + author: GitHub Action + signoff: true + branch: sync_readme + title: ":memo: Update README: Translation Progress Table" + body: | + Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request + draft: false + delete-branch: true diff --git a/.github/workflows/sync_versions.yml b/.github/workflows/sync_versions.yml deleted file mode 100644 index dce4b4b4..00000000 --- a/.github/workflows/sync_versions.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Sync Versions - -on: - push: - branches: - - main - paths: - - "build.gradle" - -permissions: - contents: write - pull-requests: write - -jobs: - sync-versions: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up Python - uses: actions/setup-python@v5.0.0 - with: - python-version: '3.x' - - name: Install dependencies - run: pip install pyyaml - - name: Sync versions - run: python .github/scripts/gradle_to_chart.py - - name: Set up git config - run: | - git config --global user.email "GitHub Action " - git config --global user.name "GitHub Action " - - name: Run git add - run: | - git add . - git diff --staged --quiet || git commit -m ":floppy_disk: Sync Versions - > Made via sync_versions.yml" || echo "no changes" - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update files - committer: GitHub Action - author: GitHub Action - signoff: true - branch: sync_version - title: ":floppy_disk: Update Version" - body: | - Auto-generated by [create-pull-request][1] - - [1]: https://github.com/peter-evans/create-pull-request - draft: false - delete-branch: true