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
|
|
|
|
|
2024-03-13 15:21:33 -07:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
|
|
|
|
env:
|
|
|
|
PR_BRANCH: "update-lockfiles"
|
|
|
|
|
2023-11-02 10:55:47 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-01-11 13:47:25 -08:00
|
|
|
|
|
|
|
- name: Install Nix
|
2024-05-20 17:08:27 -07:00
|
|
|
uses: cachix/install-nix-action@V27
|
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: |
|
2024-03-13 15:21:33 -07:00
|
|
|
git switch -c "$PR_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
|
|
|
|
2024-05-13 13:33:16 -07:00
|
|
|
- name: Update port sources
|
2023-11-02 10:55:47 -07:00
|
|
|
run: |
|
2024-05-13 13:33:16 -07:00
|
|
|
nix run --inputs-from ./dev nixpkgs#npins -- update --directory ./.sources
|
|
|
|
if ! git diff --color=always --exit-code; then
|
|
|
|
git commit -am "chore: update port sources"
|
|
|
|
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
|
2024-03-13 15:23:40 -07:00
|
|
|
git fetch origin "$PR_BRANCH" || true
|
2024-03-13 15:21:33 -07:00
|
|
|
git push --force-with-lease -u origin "$PR_BRANCH"
|
2024-01-11 12:55:06 -08:00
|
|
|
|
2024-03-13 15:21:33 -07:00
|
|
|
open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)"
|
|
|
|
if [ "$open_prs" -eq 0 ]; then
|
|
|
|
gh pr create \
|
|
|
|
--base main \
|
|
|
|
--head "$PR_BRANCH" \
|
|
|
|
--title "chore: update lockfiles" \
|
|
|
|
--fill
|
|
|
|
fi
|
2024-01-11 12:55:06 -08:00
|
|
|
fi
|