Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobianco committed Oct 20, 2024
1 parent 6ddfc57 commit a6e9358
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions bin/devops-tracking
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @package: devops-tracking
# @build_type: bin
# @build_with: Mush 0.2.0 (2024-03-21)
# @build_date: 2024-10-20T20:34:41Z
# @build_date: 2024-10-20T21:26:28Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -55,24 +55,30 @@ ACCESS_TOKEN=$(curl -s --request POST \
--data "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=$jwt" | jq -r '.access_token')

datetime=$(date +'%F %T')
monthnum=$(date +"%YM%m")
weeknum=$(date +"%YW%V")
daynum=$(date +"%YD%j")

if [ -n "${GITHUB_REPOSITORY}" ]; then
repository="https://github.com/${GITHUB_REPOSITORY}"
else
repository=$(git config --get remote.origin.url && true)
fi

release=1
error=0

# Prepara i dati da inserire
DATA='{
"range": "'$RANGE'",
"majorDimension": "ROWS",
"values": [
["'$datetime'", "'$repository'", "'$event'"]
["'$datetime'", "'$monthnum'", "'$weeknum'", "'$daynum'", "'$repository'", "'$release'", "'$error'"]
]
}'

# Invia la richiesta all'API di Google Sheets per aggiungere una riga
curl -X POST \
curl -s -X POST \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "$DATA" \
Expand Down
10 changes: 8 additions & 2 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,30 @@ ACCESS_TOKEN=$(curl -s --request POST \
--data "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=$jwt" | jq -r '.access_token')

datetime=$(date +'%F %T')
monthnum=$(date +"%YM%m")
weeknum=$(date +"%YW%V")
daynum=$(date +"%YD%j")

if [ -n "${GITHUB_REPOSITORY}" ]; then
repository="https://github.com/${GITHUB_REPOSITORY}"
else
repository=$(git config --get remote.origin.url && true)
fi

release=1
error=0

# Prepara i dati da inserire
DATA='{
"range": "'$RANGE'",
"majorDimension": "ROWS",
"values": [
["'$datetime'", "'$repository'", "'$event'"]
["'$datetime'", "'$monthnum'", "'$weeknum'", "'$daynum'", "'$repository'", "'$release'", "'$error'"]
]
}'

# Invia la richiesta all'API di Google Sheets per aggiungere una riga
curl -X POST \
curl -s -X POST \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "$DATA" \
Expand Down

0 comments on commit a6e9358

Please # to comment.