try to fix the git push frogejo action
All checks were successful
Build all NixOS Configurations / nix build (push) Successful in 5s

This commit is contained in:
Ingolf Wagner 2024-07-21 10:29:26 +02:00
parent 2b50c8f39f
commit 729ffe9584
Signed by: palo
GPG key ID: 76BF5F1928B9618B
2 changed files with 34 additions and 41 deletions

View file

@ -9,31 +9,31 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: setup ssh
run: |
cat <<EOF > .id_rsa
${{ secrets.SSH_KEY }}
EOF
chmod 600 .id_rsa
eval $(ssh-agent)
ssh-add .id_rsa
cat <<EOF > "$GITHUB_ENV"
SSH_AUTH_SOCK="$SSH_AUTH_SOCK"
SSH_AGENT_PID=$SSH_AGENT_PID
EOF
- run: nix flake archive
- name: teardown ssh
if: always()
run: |
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID
- name: nix flake check
run: nix flake check --verbose --log-format raw
# - name: setup ssh
# run: |
# cat <<EOF > .id_rsa
# ${{ secrets.SSH_KEY }}
# EOF
# chmod 600 .id_rsa
#
# eval $(ssh-agent)
# ssh-add .id_rsa
#
# cat <<EOF > "$GITHUB_ENV"
# SSH_AUTH_SOCK="$SSH_AUTH_SOCK"
# SSH_AGENT_PID=$SSH_AGENT_PID
# EOF
#
# - run: nix flake archive
#
# - name: teardown ssh
# if: always()
# run: |
# echo $SSH_AGENT_PID
# kill $SSH_AGENT_PID
#
# - name: nix flake check
# run: nix flake check --verbose --log-format raw
#- name: nix build orbi

View file

@ -2,7 +2,7 @@ name: Update Nix flakes and commit changes
on:
schedule:
- cron: "20 10 * * *" # not to frequent, GitHub only allows a few pulls per hour
- cron: "40 10 * * *" # not to frequent, GitHub only allows a few pulls per hour
jobs:
update-and-commit:
@ -27,35 +27,28 @@ jobs:
# git fetch origin main
# git rebase origin/main
- name: setup ssh
- name: update nix flakes
run: |
cat <<EOF > .id_rsa
cat <<EOF > .ssh_key
${{ secrets.SSH_KEY }}
EOF
chmod 600 .id_rsa
chmod 600 .ssh_key
eval $(ssh-agent)
ssh-add .id_rsa
ssh-add .ssh_key
cat <<EOF > "$GITHUB_ENV"
SSH_AUTH_SOCK="$SSH_AUTH_SOCK"
SSH_AGENT_PID=$SSH_AGENT_PID
EOF
- name: update nix flakes
run: nix flake update
# we need the ssh-agent here, otherwise git push would use the GITHUB_TOKEN
# which prevents other workflows to be triggered
- name: commit and push changes
run: |
nix flake update
export GITHUB_TOKEN=""
git diff --quiet && \
git diff --staged --quiet || \
(git commit -am "Update Nix flakes" && git push)
- name: teardown ssh
if: always()
run: |
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID