2023-11-02 10:55:47 -07:00
|
|
|
name: Update lockfiles
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
# run every friday
|
|
|
|
- cron: "0 0 * * 5"
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2024-01-11 12:20:49 -08:00
|
|
|
update:
|
|
|
|
name: Run update
|
2023-11-02 10:55:47 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-01-11 13:47:25 -08:00
|
|
|
|
|
|
|
- name: Install Nix
|
2024-03-13 15:08:35 -07:00
|
|
|
uses: cachix/install-nix-action@v26
|
2023-11-02 10:55:47 -07:00
|
|
|
|
|
|
|
- name: Set Git user info
|
|
|
|
run: |
|
|
|
|
git config user.name 'github-actions[bot]'
|
|
|
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
|
2024-01-11 12:20:49 -08:00
|
|
|
- name: Create new branch
|
2024-01-11 12:27:09 -08:00
|
|
|
id: branch
|
2024-01-11 12:20:49 -08:00
|
|
|
run: |
|
|
|
|
# try not to conflict with other branches
|
2024-01-11 12:27:09 -08:00
|
|
|
branch="update-lock/${{ github.run_id }}"
|
|
|
|
|
|
|
|
echo "branch=$branch" >> "$GITHUB_OUTPUT"
|
|
|
|
git switch -c "$branch"
|
2024-01-11 12:20:49 -08:00
|
|
|
|
2023-11-02 10:55:47 -07:00
|
|
|
- name: Update flake inputs
|
|
|
|
run: |
|
2023-12-16 15:38:36 -08:00
|
|
|
pushd dev
|
2024-01-11 12:20:49 -08:00
|
|
|
|
2023-11-02 10:55:47 -07:00
|
|
|
nix flake update \
|
2024-01-11 12:20:49 -08:00
|
|
|
--commit-lock-file \
|
|
|
|
--commit-lockfile-summary "chore: update dev flake inputs"
|
|
|
|
|
2023-12-16 15:38:36 -08:00
|
|
|
popd
|
2023-11-02 10:55:47 -07:00
|
|
|
|
|
|
|
- name: Update upstream sources
|
|
|
|
run: |
|
2024-01-11 13:47:25 -08:00
|
|
|
nix run --inputs-from ./dev nixpkgs#nvfetcher
|
2024-01-11 12:20:49 -08:00
|
|
|
|
|
|
|
if ! git diff --color=always --exit-code; then
|
2024-01-11 13:23:27 -08:00
|
|
|
git commit -am "chore: update nvfetcher sources"
|
2024-01-11 12:20:49 -08:00
|
|
|
fi
|
2023-11-02 10:55:47 -07:00
|
|
|
|
2024-01-11 12:55:06 -08:00
|
|
|
- name: Make PR if needed
|
2024-01-11 12:20:49 -08:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
2024-01-11 12:55:06 -08:00
|
|
|
if ! git diff --color=always --exit-code origin/main; then
|
|
|
|
git push -u origin ${{ steps.branch.outputs.branch }}
|
|
|
|
|
|
|
|
gh pr create \
|
|
|
|
--base main \
|
|
|
|
--head "${{ steps.branch.outputs.branch }}" \
|
|
|
|
--title "chore: update lockfiles" \
|
|
|
|
--fill
|
|
|
|
fi
|