fix(sentences): configure git to support pushing to the PR branch #504
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
jobs: | |
mainCI: | |
name: Main CI | |
permissions: | |
actions: write | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v27 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
primary-key: nix-update-${{ hashfiles('**/flake.nix', 'flake.lock', 'nix-dev/flake.lock', 'haskell/**/*') }} | |
restore-prefixes-first-match: nix-update- | |
gc-max-store-size-linux: 4000000000 | |
purge: true | |
purge-prefixes: nix-update- | |
purge-created: 0 | |
purge-primary-key: never | |
- name: Remove old cache profiles | |
run: rm -rf /nix/var/nix/profiles/cache | |
- name: Configure git | |
env: | |
# required for gh | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}. | |
run: | | |
${{ github.head_ref && format('gh pr checkout {0}', github.event.pull_request.number) || ''}} | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Pull latest changes | |
run: git pull --rebase --autostash | |
- name: Update flake locks | |
run: |- | |
nix profile install nix-dev/#updateLocks | |
nix run nix-dev/#updateLocks | |
- name: Format Nix files | |
run: |- | |
nix profile install nix-dev/#format | |
nix run nix-dev/#format | |
- name: Update extensions | |
run: |- | |
nix profile install nix-dev/#updateExtensions | |
nix run nix-dev/#updateExtensions -- --config .github/config.yaml | |
- name: Update extra extensions | |
run: |- | |
nix profile install nix-dev/#updateExtraExtensions | |
nix run nix-dev/#updateExtraExtensions | |
- name: Commit and push changes | |
run: |- | |
git pull --rebase --autostash | |
git add . | |
git commit \ | |
-m "action" \ | |
-m "Update flake locks" \ | |
-m "Update extensions" \ | |
-m "Update extra extensions" \ | |
|| echo "commit failed!" | |
git push | |
- name: Save flakes | |
run: |- | |
nix profile install nix-dev/#saveFlakes | |
nix run nix-dev/#saveFlakes | |
templateCI: | |
name: Template | |
permissions: | |
actions: write | |
runs-on: ubuntu-22.04 | |
needs: [ "mainCI" ] | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
- name: Pull latest changes | |
run: git pull | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v27 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
primary-key: nix-update-${{ hashfiles('template') }} | |
restore-prefixes-first-match: nix-template- | |
gc-max-store-size-linux: 4000000000 | |
purge: true | |
purge-prefixes: nix-template- | |
purge-created: 0 | |
purge-primary-key: never | |
- name: Remove old cache profiles | |
run: rm -rf /nix/var/nix/profiles/cache | |
- name: Check template VSCodium | |
run: | | |
nix profile install template/ | |
nix run template/ -- --list-extensions | |
- name: Save flakes | |
run: |- | |
nix profile install nix-dev/#saveTemplateFlake | |
nix run nix-dev/#saveTemplateFlake | |
name: Nix CI | |
"on": | |
pull_request: {} | |
push: {} | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: {} |