- Types of achievement
- View a user’s achievements
- Create an achievement
- Update an achievement
- Award an achievement
- Revoke an achievement
- Delete an achievement
- Hide achievements
Achievements (Experiment)
Introduced in GitLab 15.10 with a flag named achievements
. Disabled by default.
achievements
.
The feature is not ready for production use.Achievements are a way to reward users for their activity on GitLab. As a namespace maintainer or owner, you can create custom achievements for specific contributions, which you can award to or revoke from users based on your criteria.
As a user, you can collect achievements to highlight your contributions to different projects or groups on your profile. An achievement consists of a name, a description, and an avatar.
This feature is an Experiment. For more information about planned work, see epic 9429. Tell us about your use cases by leaving comments in the epic.
Types of achievement
Programmatically, there is only one way to create, award, revoke, or delete achievements.
Practically, you can differentiate between achievements that are awarded:
- Once and irrevocable. For example, a “First contribution merged” achievement.
- Once and revocable. For example, a “Core team member” achievement.
- Multiple times. For example, a “Contributor of the month” achievement.
View a user’s achievements
You can view a user’s achievements on their profile page.
Prerequisites:
- The user profile must be public.
- You must be a member of the namespace awarding the achievement, or the namespace must be public.
To view a user’s achievements:
- Go to the user’s profile page.
- Below the user’s avatar, see their achievements.
-
To view details about an achievement, hover over it. It displays the following information:
- Name of the achievement
- Description of the achievement
- Date when the achievement was awarded to the user
- Namespace that awarded the achievement
To retrieve a list of a user’s achievements, query the user
GraphQL type.
query {
user(username: "<username>") {
userAchievements {
nodes {
achievement {
name
description
avatarUrl
namespace {
fullPath
name
}
}
}
}
}
}
Create an achievement
You can create custom achievements to award for specific contributions.
Prerequisites:
- You must have the Maintainer or Owner role for the namespace.
To create an achievement, call the achievementsCreate
GraphQL mutation.
mutation achievementsCreate($file: Upload!) {
achievementsCreate(
input: {
namespaceId: "gid://gitlab/Namespace/<namespace id>",
name: "<name>",
description: "<description>",
avatar: $file}
) {
errors
achievement {
id
name
description
avatarUrl
}
}
}
Update an achievement
You can change the name, description, and avatar of an achievement at any time.
Prerequisites:
- You must have the Maintainer or Owner role for the namespace.
To update an achievement, call the achievementsUpdate
GraphQL mutation.
mutation achievementsUpdate($file: Upload!) {
achievementsUpdate(
input: {
achievementId: "gid://gitlab/Achievements::Achievement/<achievement id>",
name: "<new name>",
description: "<new description>",
avatar: $file}
) {
errors
achievement {
id
name
description
avatarUrl
}
}
}
Award an achievement
You can award an achievement to a user to recognize their contributions. The user receives an email notification when they are awarded an achievement.
Prerequisites:
- You must have the Maintainer or Owner role for the namespace.
To award an achievement to a user, call the achievementsAward
GraphQL mutation.
mutation {
achievementsAward(input: {
achievementId: "gid://gitlab/Achievements::Achievement/<achievement id>",
userId: "gid://gitlab/User/<user id>" }) {
userAchievement {
id
achievement {
id
name
}
user {
id
username
}
}
errors
}
}
Revoke an achievement
You can revoke a user’s achievement if you consider the user no longer meets the awarding criteria.
Prerequisites:
- You must have the Maintainer or Owner role for the namespace.
To revoke an achievement, call the achievementsRevoke
GraphQL mutation.
mutation {
achievementsRevoke(input: {
userAchievementId: "gid://gitlab/Achievements::UserAchievement/<user achievement id>" }) {
userAchievement {
id
achievement {
id
name
}
user {
id
username
}
revokedAt
}
errors
}
}
Delete an achievement
If you consider you no longer need an achievement, you can delete it. This will delete all related awarded and revoked instances of the achievement.
Prerequisites:
- You must have the Maintainer or Owner role for the namespace.
To delete an achievement, call the achievementsDelete
GraphQL mutation.
mutation {
achievementsDelete(input: {
achievementId: "gid://gitlab/Achievements::Achievement/<achievement id>" }) {
achievement {
id
name
}
errors
}
}
Hide achievements
If you don’t want to display achievements on your profile, you can opt out. To do this:
- On the top bar, in the upper-right corner, select your avatar.
- Select Edit profile.
- In the Main settings section, clear the Display achievements on your profile checkbox.
- Select Update profile settings.