From d444888ce2dba8d2400c31d5ab5304562d3a5ba0 Mon Sep 17 00:00:00 2001 From: ckie Date: Sat, 1 Jan 2022 04:10:36 +0200 Subject: [PATCH] .github: move it into update-dependencies.yml and finish up --- .github/workflows/test_dep_update.sh | 5 ++-- .github/workflows/tmp-postupdate.yml | 23 ----------------- .github/workflows/update-dependencies.yml | 30 +++++++++++++++++++++-- 3 files changed, 30 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/tmp-postupdate.yml diff --git a/.github/workflows/test_dep_update.sh b/.github/workflows/test_dep_update.sh index 77f4b4b..05f8e7e 100755 --- a/.github/workflows/test_dep_update.sh +++ b/.github/workflows/test_dep_update.sh @@ -1,15 +1,14 @@ #!/usr/bin/env nix-shell #!nix-shell -i bash -p gh jq set -e -echo "$GITHUB_API_TOKEN" | gh auth --with-token +echo "$GITHUB_API_TOKEN" | gh auth login --with-token git branch -d depupdate || true git branch depupdate git checkout depupdate json="$(gh pr list --search "author:app/github-actions" --json headRefName,number)" echo "$json" | jq '.[] | .headRefName | @text' | xargs -L1 -- git pull --rebase origin if nix flake check; then - #echo "$json" | jq ".[] | .number | @text" | xargs gh pr merge - echo wouldve merged-all + echo "$json" | jq ".[] | .number | @text" | xargs -L1 -- gh pr merge --rebase --delete-branch else gh issue create \ --title "Recent Dependency update PRs failing tests" \ diff --git a/.github/workflows/tmp-postupdate.yml b/.github/workflows/tmp-postupdate.yml deleted file mode 100644 index 5cbefb0..0000000 --- a/.github/workflows/tmp-postupdate.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: "tmp postupdate" -on: - workflow_dispatch: -jobs: - update-deps: - name: Update dependencies - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Nix Flakes doesn't work on shallow clones - fetch-depth: 0 - - uses: cachix/install-nix-action@v12 - with: - install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install - extra_nix_config: | - experimental-features = nix-command flakes - - name: Run test_dep_update - env: - GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_BASE_BRANCH: develop - run: | - ./test_dep_update.sh diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 19d504b..8d4ea48 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -20,12 +20,38 @@ jobs: - name: Create PRs for dependencies env: GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_BASE_BRANCH: develop + GITHUB_BASE_BRANCH: master run: | nix develop -c .github/workflows/update_flake_lock.py - name: Create PR for updated init.el env: GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_BASE_BRANCH: develop + GITHUB_BASE_BRANCH: master run: | nix develop -c .github/workflows/update_init_el.py + automerge-deps: + name: Automerge dependency updates + runs-on: ubuntu-latest + steps: + - name: Configure git + run: | + git config --global core.autocrlf false + git config --global user.name github-actions[bot] + git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: actions/checkout@v2 + with: + # Nix Flakes doesn't work on shallow clones + fetch-depth: 0 + - uses: cachix/install-nix-action@v12 + with: + install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install + extra_nix_config: | + experimental-features = nix-command flakes + - name: Run test_dep_update + env: + GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_BASE_BRANCH: develop + run: | + nixpkgs="$(nix eval --impure --expr 'toString (builtins.getFlake (toString ./.)).inputs.nixpkgs' | tr -d '"')" + nix-store --realize "$nixpkgs" + NIX_PATH=nixpkgs="$nixpkgs" .github/workflows/test_dep_update.sh