Merge pull request #1194 from linyinfeng/update #7909
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: "Automated update" | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@main | |
| with: | |
| fetch-depth: 0 | |
| # use PAT for git push to trigger github actions | |
| token: ${{ secrets.PAT_FOR_CREATE_PULL_REQUEST }} | |
| - name: Prepare branch | |
| run: | | |
| git checkout master | |
| git branch --force update master | |
| git checkout update | |
| - name: Install nix | |
| uses: cachix/install-nix-action@master | |
| with: | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup cachix | |
| uses: cachix/cachix-action@master | |
| with: | |
| name: linyinfeng | |
| signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | |
| - name: Cache | |
| uses: actions/cache@main | |
| with: | |
| path: | | |
| pkgs/_sources/.shake.database | |
| key: ${{ runner.os }}-${{ hashFiles('pkgs/dev-packages/nvfetcher-self/src/*') }}-${{ hashFiles('pkgs/_sources/generated.nix') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ hashFiles('pkgs/dev-packages/nvfetcher-self/src/*') }}- | |
| - name: Git config | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Setup nvchecker key file | |
| run: | | |
| cat > keyfile.toml <<EOF | |
| [keys] | |
| github = "${{ secrets.GITHUB_TOKEN }}" | |
| EOF | |
| - name: Run locale-gen | |
| run: | | |
| sudo locale-gen en_US.UTF-8 | |
| - name: Run update | |
| id: update | |
| env: | |
| LANG: en_US.UTF-8 | |
| run: | | |
| # update and set variables | |
| # - CHANGELOG | |
| nix run .#devPackages/update | |
| - name: Push to remote | |
| run: | | |
| git push --set-upstream origin update --force | |
| - name: Create pull request | |
| run: | | |
| cat >/tmp/body-file <<'EOF' | |
| ###### Changelog | |
| ```text | |
| ${{ steps.update.outputs.changelog }} | |
| ``` | |
| EOF | |
| gh pr create \ | |
| --base master \ | |
| --title 'Automated update' \ | |
| --body-file /tmp/body-file \ | |
| --head update \ | |
| --assignee linyinfeng \ | |
| --reviewer linyinfeng \ | |
| --label 'auto merge' \ | |
| --label 'auto update' || \ | |
| gh pr edit update \ | |
| --body-file /tmp/body-file | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_FOR_CREATE_PULL_REQUEST }} |