Auto sync #25
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
name: Auto sync | |
on: | |
schedule: | |
- cron: 0 21 * * * # 3:00 AM UTC+7 | |
workflow_dispatch: | |
jobs: | |
sync: | |
name: Auto sync | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
pyproject.toml | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: '.python-version' | |
cache: 'pip' | |
cache-dependency-path: | | |
pyproject.toml | |
- name: Update submodules | |
run: git submodule update --recursive --remote | |
- name: Export lock file | |
run: uv lock --no-cache | |
# https://github.com/actions/create-github-app-token#configure-git-cli-for-an-apps-bot-user | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: 'chore: sync dev env [skip ci]' | |
commit_user_name: '${{ steps.app-token.outputs.app-slug }}[bot]' | |
commit_user_email: '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' |