Allow adding/removing label on MR with CI_JOB_TOKEN

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Proposal

Allow the use of CI_JOB_TOKEN to add/remove label on MR.

e.g.:

      if grep -ri --exclude-dir='.*' todo; then
        echo "No TODO should be present in the code, add label to warn on it."
        curl -s -X PUT \
          -H "Content-Type: application/json" \
          -H "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \
          --data '{ "add_labels": "todo-present"}' \
          "https://…/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}"

currently this action isn't allowed You can use a GitLab CI/CD job token to authenticate with specific API endpoints https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html

note: #197626 (comment 273553983)

Edited by 🤖 GitLab Bot 🤖