No description
  • Python 96%
  • Nix 4%
Find a file
Fabian Hauser a79e0dfc50
Some checks failed
Test / test (push) Failing after 1s
Fix runner path problem
Somehow, nix cannot find the repo of the action - the hash and value of GITHUB_ACTION_PATH seems off.
However, maybe it's a problem with the nix runner isolation, whe have a very special setup...
2026-04-08 16:25:52 +03:00
.github/workflows update-flake-inputs: ignore tests 2025-07-15 14:05:50 +02:00
src/update_flake_inputs update-flake-inputs: print error when merging 2026-03-05 18:14:22 +01:00
tests feat: Add branch-suffix option to avoid conflicts 2026-01-26 09:50:30 +00:00
.envrc add envrc 2025-07-14 16:11:08 +02:00
.gitignore add tests for flake_service 2025-07-14 15:55:36 +02:00
action.yml Fix runner path problem 2026-04-08 16:25:52 +03:00
flake.lock Merge pull request #95 from Mic92/update-nixpkgs 2026-04-05 05:43:24 +00:00
flake.nix fix nix flake check 2025-07-14 16:50:17 +02:00
package.nix fix nix flake check 2025-07-14 16:50:17 +02:00
pyproject.toml reformat files 2025-07-22 13:15:18 +02:00
README.md feat: Expose the branch-suffix in the gitea action input 2026-01-26 09:50:30 +00:00
shell.nix fix nix flake check 2025-07-14 16:50:17 +02:00

update-flake-inputs-gitea

A Gitea Action that automatically updates Nix flake inputs and creates pull requests.

Features

  • Discovers all flake.nix files in your repository
  • Updates each flake input individually
  • Creates separate pull requests for each input update
  • Works with Git worktrees to isolate changes
  • Supports excluding specific flake files or inputs
  • Auto-merge capability for PRs when checks succeed
  • GitHub token support to avoid rate limits

Requirements

This action requires Nix to be installed on the runner. The action uses nix run to execute the flake update logic. If you have your gitea runner on nixos, you may use this nixos-module.

Usage

Add this action to your Gitea repository workflows:

name: Update Flake Inputs

on:
  schedule:
    - cron: '0 0 * * 0'  # Weekly on Sunday
  workflow_dispatch:

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Update flake inputs
      uses: Mic92/update-flake-inputs-gitea@main
      with:
        gitea-token: ${{ secrets.GITEA_TOKEN }}

Action Inputs

Input Description Required Default
gitea-url Gitea server URL Yes ${{ gitea.server_url }}
gitea-token Gitea authentication token Yes ${{ secrets.GITEA_TOKEN }}
gitea-repository Repository in format owner/repo No ${{ gitea.repository }}
exclude-patterns Comma-separated list of glob patterns to exclude flake.nix files No ''
base-branch Base branch to create PRs against No main
branch-suffix Suffix to append to update branches No ''
auto-merge Automatically merge PRs when checks succeed No false
github-token GitHub token for avoiding rate limits when fetching flake inputs No ''
git-author-name Git author name for commits No gitea-actions[bot]
git-author-email Git author email for commits No gitea-actions[bot]@noreply.gitea.io
git-committer-name Git committer name for commits No gitea-actions[bot]
git-committer-email Git committer email for commits No gitea-actions[bot]@noreply.gitea.io

Advanced Example

name: Update Flake Inputs

on:
  schedule:
    - cron: '0 0 * * 0'  # Weekly on Sunday
  workflow_dispatch:

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Update flake inputs
      uses: Mic92/update-flake-inputs-gitea@main
      with:
        gitea-token: ${{ secrets.GITEA_TOKEN }}
        base-branch: develop
        auto-merge: true
        github-token: ${{ secrets.GITHUB_TOKEN }}
        exclude-patterns: "tests/**,examples/**"

GitHub Rate Limits

When updating flake inputs that reference GitHub repositories, you may encounter rate limits. To avoid this, provide a GitHub token via the github-token input:

- name: Update flake inputs
  uses: Mic92/update-flake-inputs-gitea@main
  with:
    gitea-token: ${{ secrets.GITEA_TOKEN }}
    github-token: ${{ secrets.GITHUB_TOKEN }}

This will configure Nix to use the token when fetching from GitHub, significantly increasing the rate limit.

Custom Git Author/Committer

By default, commits are created with gitea-actions[bot] as the author. However, you may want to use a different author to:

  • Trigger specific Gitea workflows that filter on commit authors
  • Comply with organizational policies
  • Use a dedicated bot account for audit trails

You can customize the git author and committer information:

- name: Update flake inputs
  uses: Mic92/update-flake-inputs-gitea@main
  with:
    gitea-token: ${{ secrets.GITEA_TOKEN }}
    git-author-name: "My Bot"
    git-author-email: "bot@mycompany.com"
    git-committer-name: "My Bot"
    git-committer-email: "bot@mycompany.com"

Development

Setup

nix develop

Running Tests

pytest

Linting and Formatting

ruff format .
ruff check .
mypy .

License

MIT