add auto-update workflow #33
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
on: | |
push: | |
branches: | |
- master | |
- actions/auto-update | |
paths: | |
- 'flake.lock' | |
jobs: | |
check: | |
name: Check Flake outputs after flake update | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
outputs: | |
flake-check-stderr: ${{ steps.flake-check.outputs.OUT }} | |
steps: | |
- name: Checkout Repo | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
id: install-nix | |
uses: cachix/install-nix-action@v30 | |
- name: Run Flake Check | |
id: flake-check | |
continue-on-error: true | |
run: | | |
{ | |
echo $(nix flake check 2>&1) | |
} >> flake-check-stderr.txt | |
- name: Upload Flake Check Stderr | |
uses: actions/upload-artifact@v3 | |
with: | |
name: flake-check-stderr | |
path: flake-check-stderr.txt | |
maybe_repair: | |
runs-on: ubuntu-latest | |
needs: check | |
permissions: | |
contents: write | |
pull-requests: write | |
if: ${{ always() }} | |
name: Check for deprecated/renamed options in flake check and submit a pull request to fix if found | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: Download Flake Check Stderr Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: flake-check-stderr | |
path: ./ | |
- name: Run GPT Problem Prompt | |
uses: DukeLuo/[email protected] | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
with: | |
cmd: | | |
promptr --model "gpt-4o" \ | |
--prompt "Please recommend changes to any of the evaluation warnings found with the flake check output included in flake-check-stderr.txt and at the end of this message | |
For example, if an option has been removed, or replaced by a new one, remove that option declartion or update it. | |
If an option has been deprecated, handle it in a way that doesn't introduce change. Either remove or replace it as recommended in the output. Create a new file flake-changes.txt for your recommendations and findings. include the relative path to the file in the source repo (exclude the /nix/store/.../ part and assume it is relative to the repo root), the original error message, and a decided action in the file. Write in a way that you will be able to process and understand easily in the future." | |
- name: Run GPT Solution Prompt | |
uses: DukeLuo/[email protected] | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
with: | |
cmd: | | |
promptr --model "gpt-4o" \ | |
--prompt "Please make changes to fix any evaluation warnings, deprecated, missing, or removed option settings in the repo. | |
For example, if an option has been removed, or replaced by a new one, remove that option declartion or update it. Earlier you classified and recommended resolutions to the issues found in flake-check-stderr.txt | |
$(cat flake-changes.txt)" | |
- name: Cleanup | |
run: rm flake-changes.txt flake-check-stderr.txt | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
branch: actions/flake-update-fixes | |
title: "flake-update: Fix options changed during flake update" | |
commit-message: "flake-update: Fix options changed in flake update" |