Skip to content
Snippets Groups Projects
Commit f94d2387 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #16997 TIME 0:05 added commit logging in forge tickets

parent ef10eba3
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ variables:
POSTGRES_PASSWORD: ""
stages:
- logs
- test
- synchronization
......@@ -137,3 +138,44 @@ tags:
- git tag $CI_COMMIT_TAG
- git status
- git push origin --tags
logs:
image: debian:10-slim
stage: logs
except:
- schedules
- tags
- master
before_script:
# Skip the logging if in pro (=> sync disabled)
- if [ $SYNC_ENABLED = "true" ]; then echo "Sync enabled"; else echo "Sync disabled, stopping the job" && exit 0; fi
- apt-get update -y
- apt install -y curl
script:
- |
if [[ $CI_COMMIT_MESSAGE == "FEAT"* ]]; then \
ISSUE_ID=`echo $CI_COMMIT_MESSAGE | grep -o 'FEAT \#[0-9]*' | grep -o '[0-9]*'`; \
echo "found FEAT !"; \
else \
if [[ $CI_COMMIT_MESSAGE == "FIX"* ]]; then \
ISSUE_ID=`echo $CI_COMMIT_MESSAGE | grep -o 'FIX \#[0-9]*' | grep -o '[0-9]*'`; \
echo "found FIX !"; \
else \
echo "no FEAT or FIX found :("; \
exit 0; \
fi; \
fi
- echo $ISSUE_ID
- NOTE_MESSAGE="Commit ajouté sur la branche **$CI_COMMIT_REF_NAME** de **$CI_PROJECT_NAME**"
- COMMIT_URL="$CI_PROJECT_URL/commit/$CI_COMMIT_SHA"
- echo $NOTE_MESSAGE
- echo "$CI_COMMIT_MESSAGE"
- CI_COMMIT_MESSAGE=$(echo $CI_COMMIT_MESSAGE) # Remove the line returns
- echo "$CI_COMMIT_MESSAGE"
- echo $COMMIT_URL
- NOTE="$NOTE_MESSAGE \n $CI_COMMIT_MESSAGE \n $COMMIT_URL"
- echo "$NOTE"
- BODY="{\"issue\":{\"notes\":\"$NOTE\",\"private_notes\":false}}"
- echo "$BODY"
- curl -v -H 'Content-Type:application/json' -H "X-Redmine-API-Key:$REDMINE_API_KEY" -d "$BODY" -X PUT https://forge.maarch.org/issues/$ISSUE_ID.json
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment