Creates a GitLab project access token with specified permissions and expiration settings.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| name | string | Name of Access Key | |
| token | string | The token to use for authorization to GitLab | |
| scopes | array | Scopes for a project access token | |
| repoUrl | string | URL to gitlab instance | |
| expiresAt | string | Expiration date of the access token in ISO format (YYYY-MM-DD). If Empty, it will set to the maximum of 365 days. | |
| projectId | any | Project ID/Name(slug) of the Gitlab Project | |
| accessLevel | number | Access Level of the Token, 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), and 50 (Owner) |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| access_token | string | Access Token |
Usage Examples
Create a minimal project access token using integration credentials
Creates a token for an existing GitLab project using the default expiration. Use this when your GitLab integration provides the admin token and you only need to specify the project and instance.
steps:
- id: fetch_skeleton
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
name: ${{ parameters.name }}
- id: create_project_token
action: gitlab:projectAccessToken:create
input:
projectId: acme/platform/my-service
repoUrl: https://gitlab.comCreate a developer token with write access for repository and registry
Creates a token with developer access and write scopes for code and container registry. Use this for automation that pushes commits and images after fetch:template.
steps:
- id: fetch_source
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
name: ${{ parameters.serviceName }}
- id: create_dev_token
action: gitlab:projectAccessToken:create
input:
projectId: acme/payments/billing-service
repoUrl: https://gitlab.com
token: ${{ secrets.gitlabToken }}
name: scaffolder-ci-billing
accessLevel: 30
scopes:
- write_repository
- write_registry
- read_api
expiresAt: 2026-01-31Create a short-lived read-only token for preview pipelines
Creates a read-only token for preview environments tied to a branch with a controlled expiration date. Use this to allow ephemeral jobs to fetch code and query read-only APIs.
steps:
- id: fetch_template
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
branch: ${{ parameters.branchName }}
service: ${{ parameters.service }}
- id: create_preview_ro_token
action: gitlab:projectAccessToken:create
input:
projectId: ${{ parameters.projectSlug }} # e.g. acme/web/storefront
repoUrl: https://gitlab.com
token: ${{ secrets.gitlabAdminToken }}
name: preview-${{ parameters.branchName }}
accessLevel: 20
scopes:
- read_repository
- read_api
expiresAt: ${{ parameters.tokenExpiry }} # YYYY-MM-DDCreate a maintainer token for a self-hosted GitLab project
Creates a maintainer-level token on a self-hosted instance with broad automation access. Use this for trusted release bots that need repository and registry write access.
steps:
- id: fetch_assets
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
name: release-bot
- id: create_maintainer_token
action: gitlab:projectAccessToken:create
input:
projectId: 3421
repoUrl: https://gitlab.mycorp.internal
token: ${{ secrets.selfHostedGitlabToken }}
name: release-bot-token
accessLevel: 40
scopes:
- api
- write_repository
- write_registry
expiresAt: 2025-12-31Create a package publishing token with package registry scopes
Creates a token for publishing packages from CI with limited package registry permissions. Use this when your pipelines need to push to the project package registry but do not need full API access.
steps:
- id: fetch_template_pkg
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
library: ${{ parameters.serviceName }}
- id: create_pkg_registry_token
action: gitlab:projectAccessToken:create
input:
projectId: acme/libs/data-utils
repoUrl: https://gitlab.com
token: ${{ secrets.gitlabToken }}
name: pkg-publisher-${{ parameters.serviceName }}
accessLevel: 30
scopes:
- write_package_registry
- read_api
expiresAt: 2025-06-30