Tool to clone Git repositories from Forgejo Actions
Find a file
Xavier Del Campo Romero 8baa2b963b
Update examples
Previous commits have shown that the existing documentation [1] does not
reflect the reality on our CI/CD. Therefore, real-world examples have
been provided here for reference.

TODO: Also update pr.json and fork-pr.json.

[1]: https://codeberg.org/forgejo/docs/src/branch/v1.21/docs/user/actions-contexts/pull-request/root/pull_request/github
2025-01-31 23:09:53 +01:00
examples Update examples 2025-01-31 23:09:53 +01:00
forgejo-clone Do not rely on .ref_name 2025-01-31 23:06:24 +01:00
LICENSE First commit 2025-01-30 22:25:12 +01:00
README.md README.md: Fix typo 2025-01-31 21:56:14 +01:00

forgejo-clone

This project defines a simple shell script that clones a Git repository by reading an event file as generated by Forgejo Actions.

In the context of Forgejo, this shell script can be used as a minimalistic alternative to actions/checkout@v4, since this action requires a Node.JS Docker image to run, as well as some non-trivial complexity on the action itself.

Dependencies

Ubuntu/Debian

# apt install jq

How to use

forgejo-clone requires the GITHUB_EVENT_PATH and GITHUB_EVENT_NAME environment variables, which defines the path to the file that contains the full event webhook payload. Some examples of this file can be found both on the official documentation and the examples/ directory. Both GITHUB_EVENT_PATH and GITHUB_EVENT_NAME should be already defined by the Forgejo runner, but they can be defined by the user in the case of other environments.

forgejo-clone supports the following arguments:

forgejo-clone [-r] [-n] [dir]

Where:

  • -r clones the repository recursively i.e. --recursive flag is added to git clone.
  • -n performs a dry run. No actions shall be performed, but a message with the command line shall be printed to standard output.
  • dir defines the target directory to clone the repository to.

License

forgejo-clone, a tool to clone Git repositories from Forgejo Actions
Copyright (C) 2025  Xavier Del Campo Romero

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also, see LICENSE.