From 534be878b3ab79f6e95f4372f8c8f7d622ce6f1e Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 4 Jun 2024 11:46:29 +0000 Subject: [PATCH] ci: split port & flake input updates (#207) --- .github/workflows/update-flake.yml | 31 +++++++++++++ .github/workflows/update-lock.yml | 70 ------------------------------ .github/workflows/update-ports.yml | 31 +++++++++++++ 3 files changed, 62 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/update-flake.yml delete mode 100644 .github/workflows/update-lock.yml create mode 100644 .github/workflows/update-ports.yml diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml new file mode 100644 index 0000000..61543d7 --- /dev/null +++ b/.github/workflows/update-flake.yml @@ -0,0 +1,31 @@ +name: Update flake.lock + +on: + schedule: + # run every friday + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + update: + name: Run update & create PR + + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@V27 + + - uses: DeterminateSystems/update-flake-lock@v22 + with: + path-to-flake-dir: "./dev" + commit-msg: "chore: update dev flake inputs" + pr-title: "chore: update dev flake inputs" + token: ${{ github.token }} diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml deleted file mode 100644 index 1391a88..0000000 --- a/.github/workflows/update-lock.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Update lockfiles - -on: - schedule: - # run every friday - - cron: "0 0 * * 5" - workflow_dispatch: - -jobs: - update: - name: Run update - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - - env: - PR_BRANCH: "update-lockfiles" - - steps: - - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@V27 - - - name: Set Git user info - run: | - git config user.name 'github-actions[bot]' - 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 - run: | - pushd dev - - nix flake update \ - --commit-lock-file \ - --commit-lockfile-summary "chore: update dev flake inputs" - - popd - - - name: Update port sources - run: | - 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 - - - name: Make PR if needed - env: - GH_TOKEN: ${{ github.token }} - run: | - if ! git diff --color=always --exit-code origin/main; then - git fetch origin "$PR_BRANCH" || true - git push --force-with-lease -u origin "$PR_BRANCH" - - 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 - fi diff --git a/.github/workflows/update-ports.yml b/.github/workflows/update-ports.yml new file mode 100644 index 0000000..5211ea8 --- /dev/null +++ b/.github/workflows/update-ports.yml @@ -0,0 +1,31 @@ +name: Update ports + +on: + schedule: + # run every other weekday + - cron: "0 0 * * 1,3,5" + workflow_dispatch: + +jobs: + update: + name: Run update & create PR + + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@V27 + + - uses: getchoo/update-npins@v0.1.1 + with: + npins-directory: "./.sources" + commit-message: "chore: update ports" + pr-title: "chore: update ports" + token: ${{ github.token }}