-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update workflow permissions to create PR to trunk when locales need to be updated and clean up the workflow with newer dependencies including: python 3.9 -> 3.12 GH action/checkout@v2 -> action/checkout@v4 create-pull-request@v3 -> create-pull-requests@v6 actions/setup-python@v2 -> actions/setup-python@v5 With the updated dependencies we now cache python dependencies with the built-in functionality. We also only run this action if it's push to the jazzband org repo * add 'delete-branch' to auto delete PR branch after updating locale files * move permissions into job scope
- Loading branch information
1 parent
509f2b1
commit 3b71b89
Showing
1 changed file
with
36 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,47 @@ | ||
name: Locale Updater | ||
name: Update locale files | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- master | ||
|
||
|
||
jobs: | ||
locale-updater: | ||
name: Locale updater | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
if: github.repository == 'jazzband/djangorestframework-simplejwt' | ||
name: Locale updater | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: | ||
3.9-v1-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
3.9-v1- | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install -y gettext | ||
python -m pip install --upgrade pip wheel setuptools | ||
pip install -e .[dev] | ||
- name: Run locale | ||
working-directory: rest_framework_simplejwt | ||
run: | | ||
python ../scripts/i18n_updater.py | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
id: auto-commit-action | ||
with: | ||
branch: i18n-auto-update | ||
title: "[i18n] Update" | ||
body: "Updated locale files on master branch" | ||
commit-message: "Update locale files" | ||
add-paths: rest_framework_simplejwt/locale/** | ||
delete-branch: true | ||
|
||
- name: Tell whether locale updated | ||
run: echo "Locale files updated" | ||
|
||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
cache-dependency-path: setup.py | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install -y gettext | ||
python -m pip install --upgrade pip wheel setuptools | ||
pip install -e .[dev] | ||
- name: Run locale Update Script | ||
run: python scripts/i18n_updater.py | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: i18n-auto-update | ||
title: "[i18n] Update" | ||
body: "Updated locale files on trunk" | ||
commit-message: "Update locale files" | ||
add-paths: rest_framework_simplejwt/locale/** | ||
delete-branch: true |