refactor: replace flake update tasks
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
a7df832547
commit
fb2a061860
1 changed files with 15 additions and 27 deletions
42
.github/workflows/update-flake.yml
vendored
42
.github/workflows/update-flake.yml
vendored
|
@ -30,11 +30,6 @@ jobs:
|
||||||
git config user.name 'github-actions[bot]'
|
git config user.name 'github-actions[bot]'
|
||||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
|
||||||
- name: Create new branch
|
|
||||||
id: branch
|
|
||||||
run: |
|
|
||||||
git switch -c "$PR_BRANCH"
|
|
||||||
|
|
||||||
- name: Update flake inputs
|
- name: Update flake inputs
|
||||||
run: |
|
run: |
|
||||||
pushd nix/dev
|
pushd nix/dev
|
||||||
|
@ -47,26 +42,19 @@ jobs:
|
||||||
--commit-lock-file \
|
--commit-lock-file \
|
||||||
--commit-lockfile-summary "nix: update flake.lock"
|
--commit-lockfile-summary "nix: update flake.lock"
|
||||||
|
|
||||||
- name: Make PR if needed
|
- name: Create PR
|
||||||
env:
|
id: cpr
|
||||||
GH_TOKEN: ${{ github.token }}
|
uses: peter-evans/create-pull-request@v6
|
||||||
run: |
|
with:
|
||||||
if ! git diff --color=always --exit-code origin/main; then
|
base: 'main'
|
||||||
git fetch origin "$PR_BRANCH" || true
|
branch: 'update-locks'
|
||||||
git push --force-with-lease -u origin "$PR_BRANCH"
|
delete-branch: true
|
||||||
|
title: 'chore(nix): update lockfiles'
|
||||||
|
body: 'Automated pull request to update flake locks'
|
||||||
|
|
||||||
open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)"
|
- name: Enable Pull Request Automerge
|
||||||
if [ "$open_prs" -eq 0 ]; then
|
if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||||
gh pr create \
|
uses: peter-evans/enable-pull-request-automerge@v3
|
||||||
--base main \
|
with:
|
||||||
--head "$PR_BRANCH" \
|
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
|
||||||
--title "chore: update lockfiles" \
|
merge-method: merge
|
||||||
--fill
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Enable auto-merge
|
|
||||||
shell: bash
|
|
||||||
run: gh pr merge --auto --squash
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.MERGE_TOKEN }}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue