Add Gitea Actions
76
Gitea-Actions.md
Normal file
76
Gitea-Actions.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
## Built-in Environment Variables
|
||||||
|
|
||||||
|
When running a workflow in **Gitea Actions**, several environment variables are automatically available. These can be used to reference repository info, workflow/job context, or paths inside the runner/container.
|
||||||
|
|
||||||
|
### Repository Information
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
| ------------------------- | -------------------------------------------------------- |
|
||||||
|
| `GITHUB_REPOSITORY` | Full repository name (e.g., `owner/repo`) |
|
||||||
|
| `GITHUB_REPOSITORY_OWNER` | Repository owner |
|
||||||
|
| `GITHUB_REF_NAME` | Branch or tag name being built |
|
||||||
|
| `GITHUB_SHA` | Full commit SHA of the current commit |
|
||||||
|
| `GITHUB_REF` | Full ref (e.g., `refs/heads/main`) |
|
||||||
|
| `GITHUB_REF_TYPE` | Type of ref (`branch` or `tag`) |
|
||||||
|
| `GITHUB_SERVER_URL` | URL of the Gitea instance (e.g., `https://git.kopic.hr`) |
|
||||||
|
|
||||||
|
### Workspace & Paths
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
| ----------------------------------------- | ------------------------------------------------------------- |
|
||||||
|
| `GITHUB_WORKSPACE` | Path to the workspace directory where your repo can be cloned |
|
||||||
|
| `PWD` | Current working directory inside the container |
|
||||||
|
| `GITEA_PATH`, `GITEA_ENV`, `GITEA_OUTPUT` | Internal paths for storing state, environment, and output |
|
||||||
|
|
||||||
|
### Workflow & Job Info
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
| ------------------- | ---------------------------------------------------------------- |
|
||||||
|
| `GITHUB_WORKFLOW` | Name of the workflow |
|
||||||
|
| `GITHUB_JOB` | Name of the current job |
|
||||||
|
| `GITHUB_RUN_NUMBER` | Pipeline run number |
|
||||||
|
| `GITHUB_EVENT_NAME` | Event that triggered the workflow (`push`, `pull_request`, etc.) |
|
||||||
|
| `RUNNER_OS` | OS of the runner (`Linux`, `Windows`, etc.) |
|
||||||
|
| `RUNNER_ARCH` | Architecture of the runner (`amd64`, `ARM64`, etc.) |
|
||||||
|
|
||||||
|
### Gitea-specific
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
| --------------- | ---------------------------------------------- |
|
||||||
|
| `GITEA_ACTIONS` | `true` if running inside Gitea Actions |
|
||||||
|
| `ACT` | `true` if running via `act` locally (optional) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example: Manual Git Clone in a Job
|
||||||
|
|
||||||
|
Sometimes you may want to **clone the repository manually** instead of using `actions/checkout` (which requires Node). You can do it with the built-in variables like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Some job name
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
helm-lint:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: alpine:latest
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
run: |
|
||||||
|
echo "Cloning repository $GITHUB_REPOSITORY..."
|
||||||
|
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" "$GITHUB_WORKSPACE"
|
||||||
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✅ Notes:
|
||||||
|
|
||||||
|
* `$GITHUB_SERVER_URL` → your Gitea instance URL
|
||||||
|
* `$GITHUB_REPOSITORY` → repository full name (`owner/repo`)
|
||||||
|
* `$GITHUB_WORKSPACE` → clone target path inside the container
|
||||||
|
* Works **without Node**, suitable for minimal containers like `alpine/helm`
|
Reference in New Issue
Block a user