update images #41
This file contains hidden or 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: update images | |
| permissions: | |
| contents: write | |
| on: | |
| # Allow manual triggers. | |
| workflow_dispatch: {} | |
| # Run weekly (every Monday at 00:01) | |
| schedule: | |
| - cron: "0 1 * * 1" | |
| jobs: | |
| create-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get token | |
| id: app-token | |
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # 2.2.1 | |
| with: | |
| app-id: ${{ secrets.AUTO_COMMITTER_LVH_APP_ID }} | |
| private-key: ${{ secrets.AUTO_COMMITTER_LVH_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 }} | |
| - name: checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - run: | | |
| git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
| git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
| - name: commit | |
| id: commit | |
| run: | | |
| id=$(date +%Y%m%d.%H%M%S) | |
| git switch -c pr/update-images-${id} | |
| echo "update $id" > misc/dummy | |
| git add misc/dummy | |
| git commit -a -m "update-images: $id" | |
| git show HEAD | |
| git push --set-upstream origin pr/update-images-${id} | |
| echo "id=$id" | tee -a $GITHUB_OUTPUT | |
| - name: push PR | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| id=${{ steps.commit.outputs.id }} | |
| gh pr create \ | |
| --title "update images: $id" \ | |
| --body "PR to update images" \ |