- JavaScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| action.yml | ||
| index.mjs | ||
| README.md | ||
gitlab-compat
A Forgejo Actions action that gives the steps after it GitLab CI's
predefined variables (CI_*, GITLAB_*), for jobs written against GitLab
CI. A JavaScript action (index.mjs, no dependencies), run on the job
image's Node, as actions/checkout is: any image with Node runs it, such as
3rd-party/forgejo-job.
It reads what Forgejo tells a job: its environment (GITHUB_*,
FORGEJO_*), the event that started it ($GITHUB_EVENT_PATH), and the
forge's API, with the job's token, for what neither has. A variable it
cannot know is left unset rather than made up. The list follows a GitLab
job's own, env | grep -E '^(CI_|GITLAB_)' | sort on gitlab.com
(2026-11-04).
Inputs
| Input | Default | For |
|---|---|---|
server-url |
the forge's URL, its first label gitlab for git: https://gitlab.local.branchhaus.eu |
gitlab-shim, GitLab's face for the forge: CI_SERVER_*, CI_API_*, CI_PROJECT_URL |
token |
${{ github.token }} |
CI_JOB_TOKEN and the passwords; the API is read with it |
What it sets
The server, gitlab-shim:
| Variable | From |
|---|---|
CI, GITLAB_CI |
true |
CI_SERVER |
yes |
CI_SERVER_NAME |
GitLab |
CI_SERVER_URL, _PROTOCOL, _HOST, _PORT, _FQDN |
server-url |
CI_API_V4_URL, CI_API_GRAPHQL_URL |
server-url + /api/v4, /api/graphql |
CI_SERVER_SHELL_SSH_HOST, _PORT |
the repository's ssh clone URL |
The project, the repository:
| Variable | From |
|---|---|
CI_PROJECT_ID, CI_PROJECT_NAMESPACE_ID |
the repository's and its owner's ids |
CI_PROJECT_NAME, CI_PROJECT_TITLE |
its name |
CI_PROJECT_PATH, CI_PROJECT_NAMESPACE and their _SLUG |
owner/name, the owner |
CI_PROJECT_ROOT_NAMESPACE, _SLUG |
the owner: Forgejo has no nested groups |
CI_PROJECT_DESCRIPTION, CI_PROJECT_TOPICS |
the repository's |
CI_PROJECT_VISIBILITY |
private, internal or public |
CI_PROJECT_REPOSITORY_LANGUAGES |
its languages, most used first, at most five |
CI_PROJECT_URL |
server-url + /owner/name |
CI_PROJECT_DIR, CI_BUILDS_DIR |
the workspace, and the workspace less owner/name |
CI_DEFAULT_BRANCH, _SLUG |
the repository's default branch |
CI_REPOSITORY_URL |
the forge's https clone URL, as gitlab-ci-token with the token |
The commit:
| Variable | From |
|---|---|
CI_COMMIT_SHA, CI_COMMIT_SHORT_SHA |
the job's commit, and its first 8 |
CI_COMMIT_BEFORE_SHA |
a push's before; 40 zeros otherwise, as GitLab |
CI_COMMIT_REF_NAME, _SLUG |
the branch or tag |
CI_COMMIT_BRANCH or CI_COMMIT_TAG |
the same, by the ref's kind; no branch for a pull request |
CI_COMMIT_REF_PROTECTED |
the branch's protection; for a tag, whether the repository protects any |
CI_COMMIT_MESSAGE, _TITLE, _DESCRIPTION |
the head commit's message, its first line, the rest |
CI_COMMIT_MESSAGE_IS_TRUNCATED |
false |
CI_COMMIT_AUTHOR, CI_COMMIT_TIMESTAMP, CI_COMMIT_USER_LOGIN |
the head commit's author, time and login |
The pipeline, the workflow run, and the job:
| Variable | From |
|---|---|
CI_PIPELINE_ID, CI_PIPELINE_IID |
the run's id, and its number in the repository |
CI_PIPELINE_SOURCE |
the event: push, merge_request_event for a pull request, schedule, web for a dispatch |
CI_PIPELINE_URL, CI_PIPELINE_CREATED_AT |
the run's page on the forge, and when it was made |
CI_PIPELINE_NAME |
the workflow's name: |
CI_CONFIG_PATH, CI_CONFIG_REF_URI |
the workflow's file, and forge/owner/name/<file>@<ref> |
CI_JOB_ID, CI_JOB_URL, CI_JOB_TAGS |
the job's id, its page, its runs-on as JSON |
CI_JOB_NAME, CI_JOB_GROUP_NAME, CI_JOB_NAME_SLUG |
the job's key |
CI_JOB_STATUS |
running |
CI_JOB_STARTED_AT, _SLUG |
when this action ran |
CI_JOB_TOKEN |
token |
CI_JOB_RETRY_COUNT |
the run's attempt, less one |
CI_NODE_TOTAL, CI_DISPOSABLE_ENVIRONMENT |
1, true |
GITLAB_ENV |
$GITHUB_ENV: GitLab's file of variables for later steps is Forgejo's |
The runner, the user and the registry:
| Variable | From |
|---|---|
CI_RUNNER_VERSION, CI_RUNNER_DESCRIPTION |
the runner's version, and its name where it gives one |
CI_RUNNER_EXECUTABLE_ARCH |
the job's platform, as linux/amd64 |
GITLAB_USER_LOGIN, _ID, _EMAIL, _NAME |
who started the run |
CI_REGISTRY, CI_REGISTRY_IMAGE |
the forge's container registry, at its host, and host/owner/name |
CI_REGISTRY_USER, CI_REGISTRY_PASSWORD |
who started the run, and token |
The token is masked in the log, CI_JOB_TOKEN, CI_REGISTRY_PASSWORD and
CI_REPOSITORY_URL with it. Whether Forgejo takes the job's token for its
container registry is untried.
Not set, nothing in a Forgejo job knowing them: CI_JOB_STAGE (no
stages), CI_JOB_IMAGE, CI_JOB_TIMEOUT, CI_CONCURRENT_ID,
CI_CONCURRENT_PROJECT_ID, CI_RUNNER_ID, CI_RUNNER_TAGS,
CI_RUNNER_REVISION, CI_RUNNER_SHORT_TOKEN, CI_SERVER_VERSION*,
CI_SERVER_REVISION, CI_SERVER_TLS_CA_FILE, CI_PROJECT_CLASSIFICATION_LABEL,
CI_TRACEPARENT, CI_TRACESTATE, GITLAB_FEATURES; nor gitlab.com's own
services: CI_DEPENDENCY_PROXY_*, CI_PAGES_*, CI_TEMPLATE_REGISTRY_HOST.
How a step hands variables on
Each step may append to files the runner names in its environment. What they hold applies to the steps after it, not to the step itself:
| File | For | Line |
|---|---|---|
$GITHUB_ENV |
environment variables of later steps | NAME=value |
$GITHUB_OUTPUT |
the step's outputs, steps.<id>.outputs.<name> |
name=value |
$GITHUB_PATH |
directories put before PATH |
one per line |
$FORGEJO_ENV and the others are the same files. A value of several lines
goes between delimiters: NAME<<EOF, the lines, EOF. A secret the action
makes itself is masked with echo "::add-mask::<value>" before it is used;
Forgejo masks only the secrets and tokens it knows.
Referring to it
geut.sh forgejo-configure puts this directory on the forge as the public
repository actions/gitlab-compat, its files those of this checkout, and
v1 on its head (the forgejo component's README, "Actions"). The forge
looks up a uses: without a host on itself, so a workflow names it as any
action:
steps:
- uses: actions/checkout@v4
- uses: actions/gitlab-compat@v1
- run: echo "$CI_PROJECT_PATH at $CI_COMMIT_SHORT_SHA, pipeline $CI_PIPELINE_IID"
A change here reaches the forge at the next forgejo-configure, which moves
v1 to it.