diff --git a/Overview.md b/Overview.md deleted file mode 100644 index 43a81de..0000000 --- a/Overview.md +++ /dev/null @@ -1,22 +0,0 @@ -# Basic topics -## Start with Codeberg... -[Create a repository](https://codeberg.org/Codeberg/Documentation/wiki/Create-repository) - -[SSH key for Codeberg](https://codeberg.org/Codeberg/Documentation/wiki/SSH-key-for-Codeberg) - -## Work with Codeberg... -[Clone & commit via HTTP (username & password)](https://codeberg.org/Codeberg/Documentation/wiki/Clone-%26-commit-via-HTTP-%28username-%26-password%29) - -[Clone & commit via SSH (key file)](https://codeberg.org/Codeberg/Documentation/wiki/Clone-%26-commit-via-SSH) - -# Advanced topics -[Pull requests and GIT flow](https://codeberg.org/Codeberg/Documentation/wiki/Pull-requests-and-GIT-flow) - -[Merge multiple commits into one](https://codeberg.org/Codeberg/Documentation/wiki/Merge-multiple-commits-into-one) -# Wiki related topics -[Including images in wiki pages](https://codeberg.org/Codeberg/Documentation/wiki/Including-images-in-wiki-pages) - -# Other Codeberg related topics -[Terms of use](https://codeberg.org/codeberg/org/src/branch/master/TermsOfUse.md) - -[All Codeberg Wiki Pages](https://codeberg.org/Codeberg/Documentation/wiki/_pages) \ No newline at end of file diff --git a/codeberg.png b/codeberg.png deleted file mode 100644 index c7e8ec0..0000000 Binary files a/codeberg.png and /dev/null differ diff --git a/doc/advanced/features/template-repositories.md b/doc/advanced/features/template-repositories.md new file mode 100644 index 0000000..f30ea94 --- /dev/null +++ b/doc/advanced/features/template-repositories.md @@ -0,0 +1,61 @@ +--- +title: "Template Repositories" +--- + +## Template Repositories +Gitea `1.11.0` and above includes template repositories, and one feature implemented with them is auto-expansion of specific variables within your template files. +To tell Gitea which files to expand, you must include a `template` file inside the `.gitea` directory of the template repository. +Gitea uses [gobwas/glob](https://github.com/gobwas/glob) for its glob syntax. It closely resembles a traditional `.gitignore`, however there may be slight differences. + +### Example `.gitea/template` file +All paths are relative to the base of the repository +```gitignore +# All .go files, anywhere in the repository +**.go + +# All text files in the text directory +text/*.txt + +# A specific file +a/b/c/d.json + +# Batch files in both upper or lower case can be matched +**.[bB][aA][tT] +``` +**NOTE:** The `template` file will be removed from the `.gitea` directory when a repository is generated from the template. + +### Variable Expansion +In any file matched by the above globs, certain variables will be expanded. +All variables must be of the form `$VAR` or `${VAR}`. To escape an expansion, use a double `$$`, such as `$$VAR` or `$${VAR}` + +| Variable | Expands To | Transformable | +|----------------------|-----------------------------------------------------|---------------| +| REPO_NAME | The name of the generated repository | ✓ | +| TEMPLATE_NAME | The name of the template repository | ✓ | +| REPO_DESCRIPTION | The description of the generated repository | ✘ | +| TEMPLATE_DESCRIPTION | The description of the template repository | ✘ | +| REPO_OWNER | The owner of the generated repository | ✓ | +| TEMPLATE_OWNER | The owner of the template repository | ✓ | +| REPO_LINK | The URL to the generated repository | ✘ | +| TEMPLATE_LINK | The URL to the template repository | ✘ | +| REPO_HTTPS_URL | The HTTP(S) clone link for the generated repository | ✘ | +| TEMPLATE_HTTPS_URL | The HTTP(S) clone link for the template repository | ✘ | +| REPO_SSH_URL | The SSH clone link for the generated repository | ✘ | +| TEMPLATE_SSH_URL | The SSH clone link for the template repository | ✘ | + +### Transformers :robot: +Gitea `1.12.0` adds a few transformers to some of the applicable variables above. +For example, to get `REPO_NAME` in `PASCAL`-case, your template would use `${REPO_NAME_PASCAL}` + +Feeding `go-sdk` to the available transformers yields... + +| Transformer | Effect | +|-------------|------------| +| SNAKE | go_sdk | +| KEBAB | go-sdk | +| CAMEL | goSdk | +| PASCAL | GoSdk | +| LOWER | go-sdk | +| UPPER | GO-SDK | +| TITLE | Go-Sdk | + diff --git a/doc/advanced/features/webhooks.md b/doc/advanced/features/webhooks.md new file mode 100644 index 0000000..80adcae --- /dev/null +++ b/doc/advanced/features/webhooks.md @@ -0,0 +1,175 @@ +--- +title: "Webhooks" +--- + +# Webhooks + +Gitea supports web hooks for repository events. This can be configured in the settings +page `/:username/:reponame/settings/hooks` by a repository admin. Webhooks can also be configured on a per-organization and whole system basis. +All event pushes are POST requests. The methods currently supported are: + +- Gitea (can also be a GET request) +- Gogs +- Slack +- Discord +- Dingtalk +- Telegram +- Microsoft Teams +- Feishu + +### Event information + +The following is an example of event information that will be sent by Gitea to +a Payload URL: + +``` +X-GitHub-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473 +X-GitHub-Event: push +X-Gogs-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473 +X-Gogs-Event: push +X-Gitea-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473 +X-Gitea-Event: push +``` + +```json +{ + "secret": "3gEsCfjlV2ugRwgpU#w1*WaW*wa4NXgGmpCfkbG3", + "ref": "refs/heads/develop", + "before": "28e1879d029cb852e4844d9c718537df08844e03", + "after": "bffeb74224043ba2feb48d137756c8a9331c449a", + "compare_url": "http://localhost:3000/gitea/webhooks/compare/28e1879d029cb852e4844d9c718537df08844e03...bffeb74224043ba2feb48d137756c8a9331c449a", + "commits": [ + { + "id": "bffeb74224043ba2feb48d137756c8a9331c449a", + "message": "Webhooks Yay!", + "url": "http://localhost:3000/gitea/webhooks/commit/bffeb74224043ba2feb48d137756c8a9331c449a", + "author": { + "name": "Gitea", + "email": "someone@gitea.io", + "username": "gitea" + }, + "committer": { + "name": "Gitea", + "email": "someone@gitea.io", + "username": "gitea" + }, + "timestamp": "2017-03-13T13:52:11-04:00" + } + ], + "repository": { + "id": 140, + "owner": { + "id": 1, + "login": "gitea", + "full_name": "Gitea", + "email": "someone@gitea.io", + "avatar_url": "https://localhost:3000/avatars/1", + "username": "gitea" + }, + "name": "webhooks", + "full_name": "gitea/webhooks", + "description": "", + "private": false, + "fork": false, + "html_url": "http://localhost:3000/gitea/webhooks", + "ssh_url": "ssh://gitea@localhost:2222/gitea/webhooks.git", + "clone_url": "http://localhost:3000/gitea/webhooks.git", + "website": "", + "stars_count": 0, + "forks_count": 1, + "watchers_count": 1, + "open_issues_count": 7, + "default_branch": "master", + "created_at": "2017-02-26T04:29:06-05:00", + "updated_at": "2017-03-13T13:51:58-04:00" + }, + "pusher": { + "id": 1, + "login": "gitea", + "full_name": "Gitea", + "email": "someone@gitea.io", + "avatar_url": "https://localhost:3000/avatars/1", + "username": "gitea" + }, + "sender": { + "id": 1, + "login": "gitea", + "full_name": "Gitea", + "email": "someone@gitea.io", + "avatar_url": "https://localhost:3000/avatars/1", + "username": "gitea" + } +} +``` + +### Example + +This is an example of how to use webhooks to run a php script upon push requests to the repository. +In your repository Settings, under Webhooks, Setup a Gitea webhook as follows: + +- Target URL: http://mydomain.com/webhook.php +- HTTP Method: POST +- POST Content Type: application/json +- Secret: 123 +- Trigger On: Push Events +- Active: Checked + +Now on your server create the php file webhook.php + +``` + [@John](#), can you give this a look? + +This is also valid for teams and organizations: + +> [@Documenters](#), we need to plan for this. + +> [@CoolCompanyInc](#), this issue concerns us all! + +Teams will receive mail notifications when appropriate, but whole organizations won't. + +Commit messages do not produce user notifications. + +## Commits + +Commits can be referenced using their SHA1 hash, or a portion of it of +at least seven characters. They will be shown as a link to the corresponding +commit. + +Example: + +> This bug was introduced in [e59ff077](#) + +## Issues and Pull Requests + +A reference to another issue or pull request can be created using the simple +notation `#1234`, where _1234_ is the number of an issue or pull request +in the same repository. These references will be shown as links to the +referenced content. + +The effect of creating this type of reference is that a _notice_ will be +created in the referenced document, provided the creator of the reference +has reading permissions on it. + +Example: + +> This seems related to [#1234](#) + +Issues and pull requests in other repositories can be referred to as well +using the form `owner/repository#1234`: + +> This seems related to [mike/compiler#1234](#) + +Alternatively, the `!1234` notation can be used as well. Even when in Gitea +a pull request is a form of issue, the `#1234` form will always link to +an issue; if the linked entry happens to be a pull request instead, Gitea +will redirect as appropriate. With the `!1234` notation, a pull request +link will be created, which will be redirected to an issue if required. +However, this distinction could be important if an external tracker is +used, where links to issues and pull requests are not interchangeable. + +## Actionable References in Pull Requests and Commit Messages + +Sometimes a commit or pull request may fix or bring back a problem documented +in a particular issue. Gitea supports closing and reopening the referenced +issues by preceding the reference with a particular _keyword_. Common keywords +include "closes", "fixes", "reopens", etc. This list can be customized by the +site administrator. + +Example: + +> This PR _closes_ [#1234](#) + +If the actionable reference is accepted, this will create a notice on the +referenced issue announcing that it will be closed when the referencing PR +is merged. + +For an actionable reference to be accepted, _at least one_ of the following +conditions must be met: + +* The commenter has permissions to close or reopen the issue at the moment +of creating the reference. +* The reference is inside a commit message. +* The reference is posted as part of the pull request description. + +In the last case, the issue will be closed or reopened only if the merger +of the pull request has permissions to do so. + +Additionally, only pull requests and commit messages can create an action, +and only issues can be closed or reopened this way. + +The default _keywords_ are: + +* **Closing**: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved +* **Reopening**: reopen, reopens, reopened + +## External Trackers + +Gitea supports the use of external issue trackers, and references to issues +hosted externally can be created in pull requests. However, if the external +tracker uses numbers to identify issues, they will be indistinguishable from +the pull requests hosted in Gitea. To address this, Gitea allows the use of +the `!` marker to identify pull requests. For example: + +> This is issue [#1234](#), and links to the external tracker. + +> This is pull request [!1234](#), and links to a pull request in Gitea. + +The `!` and `#` can be used interchangeably for issues and pull request _except_ +for this case, where a distinction is required. If the repository uses external +tracker, commit message for squash merge will use `!` as reference by default. + +## Issues and Pull Requests References Summary + +This table illustrates the different kinds of cross-reference for issues and pull requests. +In the examples, `User1/Repo1` refers to the repository where the reference is used, while +`UserZ/RepoZ` indicates a different repository. + +| Reference in User1/Repo1 | Repo1 issues are external | RepoZ issues are external | Should render | +|---------------------------|:-------------------------:|:-------------------------:|----------------------------------| +| `#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | +| `!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | +| `#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` | +| `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | +| `User1/Repo1#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | +| `User1/Repo1!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | +| `User1/Repo1#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` | +| `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | +| `UserZ/RepoZ#1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` | +| `UserZ/RepoZ!1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` | +| `UserZ/RepoZ#1234` | N/A | yes | A link to _external issue_ 1234 for `UserZ/RepoZ` | +| `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 for `UserZ/RepoZ` | +| **Alphanumeric issue IDs:** | - | - | - | +| `AAA-1234` | yes | N/A | A link to _external issue_ `AAA-1234` for `User1/Repo1` | +| `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | +| `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | +| _Not supported_ | N/A | yes | A link to _external issue_ `AAA-1234` for `UserZ/RepoZ` | +| `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 in `UserZ/RepoZ` | + +_The last section is for repositories with external issue trackers that use alphanumeric format._ + +_**N/A**: not applicable._ + +Note: automatic references between repositories with different types of issues (external vs. internal) are not fully supported +and may render invalid links. diff --git a/Codeberg-build-deploy-gitea-pull-request.png b/doc/getting-started/usage/pull-request-button.png similarity index 100% rename from Codeberg-build-deploy-gitea-pull-request.png rename to doc/getting-started/usage/pull-request-button.png diff --git a/Pull-requests-and-GIT-flow.md b/doc/getting-started/usage/pull-requests-and-git-flow.md similarity index 78% rename from Pull-requests-and-GIT-flow.md rename to doc/getting-started/usage/pull-requests-and-git-flow.md index 9b3e968..896b301 100644 --- a/Pull-requests-and-GIT-flow.md +++ b/doc/getting-started/usage/pull-requests-and-git-flow.md @@ -1,8 +1,14 @@ +--- +title: "Pull requests and Git flow" +--- + +# Pull requests and Git flow + ## Benefits of a pull-request based workflow -> ***&TLDR;*** *Keep an eye on your repository and org permissions. Don't take sweets from strangers. Use pull requests. Easy to review, easy to manage, and only the project maintainers/owners need full access to the repo to merge them.* +> ***TLDR:*** *Keep an eye on your repository and org permissions. Don't take sweets from strangers. Use pull requests. Easy to review, easy to manage, and only the project maintainers/owners need full access to the repo to merge them.* -Although it is perfectly possible to use a GIT project on Codeberg just as single shared central repository for individuals and teams, a collaborative workflow based on pull requests provides many benefits: +Although it is perfectly possible to use a Git project on Codeberg just as single shared central repository for individuals and teams, a collaborative workflow based on pull requests provides many benefits: - The "hot" project repository requires only very few maintainers with full rights to sign off pull requests. Contributors can easily work on forked repositories. - Each pull request collects the full edit history for a fix or feature branch. Contributors can squash this, or keep it, just as they prefer. @@ -13,7 +19,7 @@ Let's say, you would like to contribute to project [https://codeberg.org/Codeber First, fork the project you would like to work on, by clicking the `fork` button on the top-right corner of the project page: -![Fork a project](Codeberg-build-deploy-gitea-fork.png) +![Fork a project](fork-button.png) Then clone it onto your local machine. We assume that you have set up your SSH keys as described in [SSH-key-for-Codeberg](https://codeberg.org/Codeberg/Documentation/wiki/SSH-key-for-Codeberg). This has to be done only once: @@ -39,7 +45,7 @@ git push Now you can create the pull request by selecting your feature branch, and clicking on the pull request button: -![Create a pull request](Codeberg-build-deploy-gitea-pull-request.png) +![Create a pull request](pull-request-button.png) ### Keep it up-to-date: rebase pull requests to upstream @@ -60,6 +66,10 @@ git pull That's it. You can now push your changes, and create the pull request as usual by clicking on the "pull request" button. +## "Work In Progress" pull requests + +Marking a pull request as being a work in progress will prevent that pull request from being accidentally merged. To mark a pull request as being a work in progress, you must prefix its title by `WIP:` or `[WIP]` (case insensitive). + ## A friendly note on owner rights, and forced push permissions Please keep in mind that project owners can do *everything*, including editing and rewriting the history using `force-push`. In some cases this is a useful feature (for example to undo accidental commits that, say, leaked credentials), but in most cases a transparent history based on a pull-request based workflow is surely preferable. diff --git a/Merge-multiple-commits-into-one.md b/doc/getting-started/usage/squash-commits.md similarity index 91% rename from Merge-multiple-commits-into-one.md rename to doc/getting-started/usage/squash-commits.md index e78a94d..b4dc85c 100644 --- a/Merge-multiple-commits-into-one.md +++ b/doc/getting-started/usage/squash-commits.md @@ -1,3 +1,8 @@ +--- +title: "Merge multiple commits into one" +--- + +# Merge multiple commits into one Sometimes you will merge multiple commits into one. Maybe the commits are "dirty" full with not working code or embarrasing commit messages. This solution is only one of mutliple possible solutions. See this [stackoverflow question](https://stackoverflow.com/q/2563632/4865723) for more details and variants. Here is an example. diff --git a/Including-images-in-wiki-pages.md b/doc/getting-started/wiki/including-images-in-wiki-pages.en-us.md similarity index 82% rename from Including-images-in-wiki-pages.md rename to doc/getting-started/wiki/including-images-in-wiki-pages.en-us.md index 7b7fcd5..cba0656 100644 --- a/Including-images-in-wiki-pages.md +++ b/doc/getting-started/wiki/including-images-in-wiki-pages.en-us.md @@ -1,3 +1,9 @@ +--- +title: "Including images in wiki pages" +--- + +# Including images in wiki pages + ### Upload images via git Currently, gitea supports only images in the base directory of the wiki git. (Gitea wiki pages are stored in a separate wiki right beside the project, wiki pages themselves are markdown files). @@ -19,8 +25,6 @@ Now, you can reference the image in markdown, like this: ![image alt text](codeberg.png "image title") ``` -After saving your changes, the image should be visible like this: +After saving your changes, the image should be visible. *NOTE: In contrast to embedding external images, images in git are only rendered after saving the wiki or markdown file changes.* - -![image alt text](codeberg.png "image title") diff --git a/doc/help/faq.md b/doc/help/faq.md new file mode 100644 index 0000000..a17a1ae --- /dev/null +++ b/doc/help/faq.md @@ -0,0 +1,28 @@ +--- +title: "FAQ" +--- + +# Frequently Asked Questions + +This page contains some common questions and answers. + +* [How to migrate from GitHub/etc. to Codeberg](#how-to-migrate-from-gogs-github-etc-to-codeberg) +* [Translation is incorrect/how to add more translations](#translation-is-incorrect-how-to-add-more-translations) +* [Hooks aren't running](#hooks-aren-t-running) +* [Why is my markdown broken](#why-is-my-markdown-broken) + +## How to migrate from GitHub/etc. to Codeberg +To migrate from GitHub to Codeberg, you can use the built-in migration form. +In order to migrate items such as issues, pull requests, etc. you will need to input at least your username. +[Try it out!](https://codeberg.org/repo/migrate) + +To migrate from Gitlab to Codeberg, you can use this non-affiliated tool: +https://github.com/loganinak/MigrateGitlabToGogs + +## Translation is incorrect/how to add more translations +Our translations are currently crowd-sourced from the Gitea [Crowdin project](https://crowdin.com/project/gitea). + +## Why is my markdown broken +Gitea version `1.11` moved to using [goldmark](https://github.com/yuin/goldmark) for markdown rendering, which is [CommonMark](https://commonmark.org/) compliant. +If you have markdown that worked as you expected prior to version `1.11` and after upgrading it's not working anymore, please look through the CommonMark spec to see whether the problem is due to a bug or non-compliant syntax. +If it is the latter, _usually_ there is a compliant alternative listed in the spec. diff --git a/doc/help/issues.md b/doc/help/issues.md new file mode 100644 index 0000000..b40556b --- /dev/null +++ b/doc/help/issues.md @@ -0,0 +1,7 @@ +--- +title: "Issue" +--- + +# Issues + +If you found any issues with Codeberg, please create an [issue on Codeberg/Community](https://codeberg.org/Codeberg/Community/issues).