From 4f3602633fd6f485e8bc6dc31016471469ad5d60 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Thu, 13 Jun 2024 12:04:45 +0200 Subject: [PATCH 1/4] ci: add workflow to update `flake.lock` --- .github/workflows/flake-update.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/flake-update.yml diff --git a/.github/workflows/flake-update.yml b/.github/workflows/flake-update.yml new file mode 100644 index 000000000..2e0484794 --- /dev/null +++ b/.github/workflows/flake-update.yml @@ -0,0 +1,32 @@ +name: flake-update + +on: + workflow_dispatch: + inputs: + branch: + description: "branch" + type: "string" + default: "dev" + +jobs: + flake-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + - uses: DeterminateSystems/nix-installer-action@v12 + - name: update `flake.lock` + run: nix flake update + - name: commit + run: | + [[ $(git diff) != "" ]] || exit 0 + COMMITTER=$(curl "https://api.github.com/search/commits?q=author:${{ github.actor }}&sort=author-date&order=desc&page=1" | jq '.items.[0].commit.committer') + NAME=$(echo "$COMMITTER" | jq '.name') + EMAIL=$(echo "$COMMITTER" | jq '.email') + git config --local user.name "$NAME" + git config --local user.email "$EMAIL" + git commit -am "update \`flake.lock\`" + - uses: ad-m/github-push-action@v0.8 + with: + branch: ${{ inputs.branch }} From ae858055aaced198b56aefb4d0dd5a39a57c9965 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Thu, 13 Jun 2024 12:13:58 +0200 Subject: [PATCH 2/4] fix --- .github/workflows/flake-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake-update.yml b/.github/workflows/flake-update.yml index 2e0484794..3c0362b89 100644 --- a/.github/workflows/flake-update.yml +++ b/.github/workflows/flake-update.yml @@ -27,6 +27,6 @@ jobs: git config --local user.name "$NAME" git config --local user.email "$EMAIL" git commit -am "update \`flake.lock\`" - - uses: ad-m/github-push-action@v0.8 + - uses: ad-m/github-push-action@master with: branch: ${{ inputs.branch }} From 7ce9efb834d3ead7a8e0fdf99b1b8b92fe319ad4 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Thu, 13 Jun 2024 12:20:12 +0200 Subject: [PATCH 3/4] fix --- .github/workflows/flake-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake-update.yml b/.github/workflows/flake-update.yml index 3c0362b89..fb3741d4f 100644 --- a/.github/workflows/flake-update.yml +++ b/.github/workflows/flake-update.yml @@ -21,7 +21,7 @@ jobs: - name: commit run: | [[ $(git diff) != "" ]] || exit 0 - COMMITTER=$(curl "https://api.github.com/search/commits?q=author:${{ github.actor }}&sort=author-date&order=desc&page=1" | jq '.items.[0].commit.committer') + COMMITTER=$(curl "https://api.github.com/search/commits?q=author:${{ github.actor }}&sort=author-date&order=desc&page=1" | jq '.items[0].commit.committer') NAME=$(echo "$COMMITTER" | jq '.name') EMAIL=$(echo "$COMMITTER" | jq '.email') git config --local user.name "$NAME" From 174706acbef9537cb0c88ff2aa94f1a62b32a100 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Fri, 14 Jun 2024 13:13:58 +0200 Subject: [PATCH 4/4] only commit `flake.lock` --- .github/workflows/flake-update.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flake-update.yml b/.github/workflows/flake-update.yml index fb3741d4f..5eba85c3d 100644 --- a/.github/workflows/flake-update.yml +++ b/.github/workflows/flake-update.yml @@ -26,7 +26,8 @@ jobs: EMAIL=$(echo "$COMMITTER" | jq '.email') git config --local user.name "$NAME" git config --local user.email "$EMAIL" - git commit -am "update \`flake.lock\`" + git add flake.lock + git commit -m "update \`flake.lock\`" - uses: ad-m/github-push-action@master with: branch: ${{ inputs.branch }}