Gitea icon

Gitea

Interact with Gitea via API

Actions393

Overview

This node operation allows you to delete a file from a repository hosted on a Gitea server via its API. It is useful in scenarios where you want to automate repository maintenance tasks such as removing obsolete files, cleaning up branches, or managing content programmatically without manually accessing the repository interface.

Practical examples include:

  • Automatically deleting configuration files that are no longer needed after deployment.
  • Removing sensitive files from a branch before merging.
  • Cleaning up temporary files created during CI/CD pipelines.

Properties

Name Meaning
Owner The owner of the repository (user or organization name).
Repo The name of the repository from which the file will be deleted.
Filepath The path to the file within the repository that should be deleted.
Author JSON object representing the identity of the author of the commit (e.g., name, email).
Branch Optional branch name to base the deletion on; if omitted, the default branch is used.
Committer JSON object representing the identity of the committer of the commit (e.g., name, email).
Dates JSON object specifying commit date options for author and committer dates.
Message Optional commit message describing the deletion; if not provided, a default message is used.
New Branch Optional new branch name to create from the specified branch before deleting the file.
Sha The SHA hash of the file version that currently exists; required to ensure the correct file is deleted.
Signoff Boolean indicating whether to add a "Signed-off-by" trailer by the committer at the end of the commit message. Defaults to true.

Output

The node outputs JSON data representing the result of the file deletion operation. This typically includes confirmation details such as commit information, status of the deletion, and metadata about the repository state after the change.

If binary data were involved (e.g., file contents), it would be summarized here, but this operation focuses on deletion and thus does not output binary data.

Dependencies

  • Requires access to a Gitea instance with API enabled.
  • Needs an API authentication token or key configured in n8n credentials to authorize requests.
  • The node uses the Gitea REST API endpoint /api/v1 to perform operations.
  • Proper permissions on the repository to delete files and create commits are necessary.

Troubleshooting

  • Common issues:

    • Incorrect or missing SHA value can cause the deletion to fail because the API requires the current file SHA to prevent conflicts.
    • Insufficient permissions or invalid API credentials will result in authorization errors.
    • Specifying a non-existent branch or file path will cause errors indicating resource not found.
    • Malformed JSON in author, committer, or dates fields may cause request failures.
  • Error messages and resolutions:

    • "File SHA does not match" — Ensure the SHA corresponds exactly to the current file version in the repo.
    • "Unauthorized" or "Forbidden" — Verify API credentials and user permissions.
    • "Branch not found" — Confirm the branch name is correct or omit to use the default branch.
    • "Invalid JSON" in author/committer/dates — Validate JSON syntax before input.

Links and References

Discussion