Skip to content
Snippets Groups Projects

Draft: Resolve "Automate issue workflow"

Open Julien Touchais requested to merge 25-automate-issue-workflow into dev
Compare and Show latest version
2 files
+ 43
33
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 40
14
stages:
- post-merge
- install
- test
- post-merge
.npm-cache-ro:
cache:
- &npm-cache-ro
key:
files:
- package-lock.json
paths:
- node_modules/
policy: pull
install-deps:
stage: install
stage: .pre
cache:
- <<: *npm-cache-ro
policy: pull-push
- key: $CI_JOB_NAME
paths:
- .npm/
image: node
script:
- npm ci
artifacts:
paths:
- node_modules/
expire_in: 10 mins
- npm ci --cache .npm --prefer-offline
type-check:
stage: test
needs:
- job: install-deps
artifacts: true
- install-deps
extends: .npm-cache-ro
image: node
script:
- npm run type-check
@@ -25,10 +36,25 @@ type-check:
label-issues-merge:
stage: post-merge
image: curlimages/curl-base:latest
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' &&
$CI_MERGE_REQUEST_EVENT_TYPE == 'merge_result' &&
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
allow_failure: true
before_script:
- apk add --no-cache jq
variables:
PROJECT_API_URL: $CI_API_V4_URL/projects/$CI_PROJECT_ID
CLOSED_ISSUES_API_URL: $PROJECT_API_URL/merge_requests/$CI_MERGE_REQUEST_IID/closes_issues
script:
- closed_issue_ids=$(curl CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_ID/closes_issues | jq '.[].iid')
- echo $closed_issue_ids
- CLOSED_ISSUES=$(curl --header "PRIVATE-TOKEN:$CI_PROJECT_API_TOKEN" --url $CLOSED_ISSUES_API_URL)
- CLOSED_ISSUE_IDS=$(echo $CLOSED_ISSUES | jq '.[].iid')
- |
for ISSUE_ID in $(eval $GET_CLOSED_ISSUE_IDS); do
curl --request PUT\
--header "PRIVATE-TOKEN:$CI_PROJECT_API_TOKEN"\
--url $PROJECT_API_URL/issues/$ISSUE_ID?remove_labels=Doing
curl --request PUT\
--header "PRIVATE-TOKEN:$CI_PROJECT_API_TOKEN"\
--url $PROJECT_API_URL/issues/$ISSUE_ID?add_labels=Done
done
Loading