Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use github app token #1926

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}

- name: Install doctl 🌊
uses: digitalocean/action-doctl@v2.5.0
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ jobs:
DOCKER_IMAGE: registry.digitalocean.com/${{ secrets.DIGITALOCEAN_REGISTRY }}/${{ secrets.DIGITALOCEAN_APP_NAME }}:${{ github.sha }}

steps:
- name: Create GitHub App token 🔑
id: create-app-token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
token: ${{ secrets.PAT }}
token: ${{ steps.create-app-token.outputs.token }}

- name: Setup Python 🐍
id: setup-python
Expand All @@ -162,22 +169,23 @@ jobs:
run: poetry install --no-interaction --no-root

- name: Update localization source file 📄
id: update-i18n-source
run: |
source .venv/bin/activate
pybabel extract pdf_bot/ -o locale/pdf_bot.pot
pybabel update -l locale -i locale/pdf_bot.pot -o locale/en_GB/LC_MESSAGES/pdf_bot.po
echo NUM_DIFFS=$(git diff --shortstat | egrep -o '[0-9]+ i' | egrep -o '[0-9]+') >> $GITHUB_ENV

- name: Commit changes 🆕
if: env.NUM_DIFFS > 1
if: ${{ steps.update-i18n-source.outputs.NUM_DIFFS }} > 1
uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: "ci: update localization source file [skip ci]"
file_pattern: locale/en_GB/LC_MESSAGES/pdf_bot.po
push_options: --force

- name: Upload sources and download translations 🌐
if: env.NUM_DIFFS > 1
if: ${{ steps.update-i18n-source.outputs.NUM_DIFFS }} > 1
uses: crowdin/github-action@v1.16.0
with:
upload_sources: true
Expand All @@ -190,7 +198,7 @@ jobs:
source: locale/en_GB/LC_MESSAGES/pdf_bot.po
translation: /locale/%locale_with_underscore%/LC_MESSAGES/pdf_bot.po
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ steps.create-app-token.outputs.token }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/update-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ jobs:
name: Update Translations
runs-on: ubuntu-latest
steps:
- name: Create GitHub App token 🔑
id: create-app-token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Checkout 🛎️
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}

- name: Download translations 🌐
uses: crowdin/github-action@v1.16.0
Expand All @@ -29,6 +34,6 @@ jobs:
source: locale/en_GB/LC_MESSAGES/pdf_bot.po
translation: /locale/%locale_with_underscore%/LC_MESSAGES/pdf_bot.po
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ steps.create-app-token.outputs.token }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}