Update dependencies and create a PR with necessary Build check #424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: "Update dependencies and create a PR with necessary Build check" | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "0 0 */1 * *" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
outputs: | |
sha: ${{ steps.create-pr.outputs.pull-request-head-sha }} | |
check_id: ${{ steps.create-check.outputs.check_id }} | |
permissions: | |
checks: write | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v20 | |
- name: Update flake.lock | |
run: | | |
nix flake update nixpkgs | |
nix flake update home-manager | |
nix flake update nh | |
nix flake update impermanence | |
nix flake update agenix | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v5 | |
id: create-pr | |
with: | |
title: Update flake.lock | |
add-paths: flake.lock | |
commit-message: "chore: update flake.lock" | |
body: | | |
Automatically created by [this](https://github.com/debugloop/dotfiles/actions/runs/${{ github.run_id }}) run. | |
delete-branch: true | |
draft: false | |
- name: Create PR check | |
id: create-check | |
uses: LouisBrunner/[email protected] | |
if: ${{ steps.create-pr.outputs.pull-request-head-sha }} | |
with: | |
name: Build System Flake | |
token: ${{ secrets.GITHUB_TOKEN }} | |
sha: ${{ steps.create-pr.outputs.pull-request-head-sha }} | |
details_url: https://github.com/debugloop/dotfiles/actions/runs/${{ github.run_id }} | |
output: '{ "summary": "https://github.com/debugloop/dotfiles/actions/runs/${{ github.run_id }}" }' | |
status: in_progress | |
- run: gh pr merge --auto --rebase --delete-branch ${{ steps.create-pr.outputs.pull-request-number }} | |
if: ${{ steps.create-pr.outputs.pull-request-head-sha }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run-check: | |
needs: update | |
if: ${{ needs.update.outputs.sha }} | |
uses: debugloop/dotfiles/.github/workflows/build.yml@main | |
with: | |
sha: ${{ needs.update.outputs.sha }} | |
set-check-result: | |
needs: | |
- update | |
- run-check | |
if: ${{ needs.update.outputs.sha }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update PR check | |
uses: LouisBrunner/[email protected] | |
with: | |
check_id: ${{ needs.update.outputs.check_id }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
conclusion: ${{ needs.run-check.result }} |