Forgejo icon

Forgejo

Interact with Forgejo API

Overview

This node interacts with the Forgejo API to perform various operations on repositories, including retrieving the contents of files within a repository. Specifically, the 'Get Contents' operation fetches the content of a specified file path from a given repository owned by a user or organization. It supports specifying a reference such as a branch, tag, or commit to get the content from. This is useful for automation workflows that need to read file contents from repositories, for example, to analyze code, fetch configuration files, or integrate repository data into other systems.

Use Case Examples

  1. Retrieve the README file content from a repository's main branch to display in a dashboard.
  2. Fetch a configuration file from a specific commit to validate deployment settings.
  3. Get the contents of a script file from a tag to automate testing or deployment processes.

Properties

Name Meaning
Owner The username or organization that owns the repository.
Repository The name of the repository from which to get the file contents.
File Path The path to the file within the repository whose contents are to be retrieved.
Reference The branch, tag, or commit SHA to get the file contents from. If not specified, defaults to the repository's default branch.

Output

JSON

  • json - The JSON response containing the file content and metadata from the repository.

Dependencies

  • Forgejo API authentication credentials (an API key or token)

Troubleshooting

  • Ensure the 'Owner', 'Repository', and 'File Path' parameters are correctly specified; incorrect values will result in errors or empty responses.
  • If specifying a 'Reference', verify that the branch, tag, or commit exists in the repository.
  • Check that the API credentials have sufficient permissions to access the repository and its contents.
  • Common errors include 404 Not Found if the file path or reference does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion