summaryrefslogtreecommitdiff
path: root/.gitlab/maintenance.yml
blob: 09cb5306809c006fad294e71249cf01ec24cbc2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
update-spdx:
   stage: maintenance
   image: alpine:3.9
   script:
     - apk add --no-cache git
     - git config --global user.email "gitlab-bot@gitlab.com"
     - git config --global user.name "GitLab Bot"
     - git config --global credential.username "gitlab-bot"
     - "before=$(cksum spdx-licenses.json | awk -F' ' '{ print $1 }')"
     - echo ${before}
     - ./bin/update-spdx
     - "after=$(cksum spdx-licenses.json | awk -F' ' '{ print $1 }')"
     - echo ${after}
     - test $before -eq $after && exit 0
     - export BRANCH="$CI_JOB_NAME-$CI_PIPELINE_IID"
     - git checkout -b $BRANCH
     - git add spdx-licenses.json
     - git commit -m "Update spdx-licenses.json"
     - git push  -o merge_request.label=\"group::composition analysis\" -o merge_request.create -o merge_request.remove_source_branch -o merge_request.target=$CI_COMMIT_REF_NAME ${CI_PROJECT_URL/https:\/\/gitlab.com/https://gitlab-bot:$GITLAB_TOKEN@gitlab.com}.git $BRANCH
   rules:
     - if: '$CI_UPDATE_SPDX == "true"'