No description
  • Python 94.1%
  • Nix 5.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Fabian Hauser bf444eb078 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-06-09 15:20:06 +03:00
.github ci: drop GitHub Actions test workflow 2026-04-24 01:20:30 +02:00
src/update_flake_inputs Don't force push with no changes at all 2026-05-15 17:56:20 +02:00
tests tests: extract work_repo fixture, deduplicate git env 2026-05-19 11:32:59 +02:00
.envrc add envrc 2025-07-14 16:11:08 +02:00
.gitignore flake: add mypy check 2026-04-24 02:46:02 +02:00
action.yml Fix runner path problem 2026-06-09 15:20:06 +03:00
flake.lock build(deps): bump nixpkgs from 64c08a7 to 331800d 2026-06-04 09:00:14 +00:00
flake.nix flake: add mypy check 2026-04-24 02:46:02 +02:00
package.nix fix nix flake check 2025-07-14 16:50:17 +02:00
pyproject.toml Allow configuring merge style 2026-05-05 11:51:29 +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