Compare commits
2 Commits
9d6d0ee899
...
e50770c4ef
Author | SHA1 | Date | |
---|---|---|---|
e50770c4ef | |||
a31d481243 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
dsr-build-temp/
|
||||
dsr-build-output/
|
||||
local/build-temp/
|
||||
local/build-output/
|
@@ -5,7 +5,7 @@
|
||||
#############################################################################
|
||||
#SET THIS NEXT VARIABLE OR NOTHING WILL WORK!!!!
|
||||
|
||||
export PipelineClientWorkingDir="D:/tsys/@ReachableCEO/MarkdownResume-Pipeline-ClientExample/local"
|
||||
export PipelineClientWorkingDir="D:/tsys/@ReachableCEO/DSR-Pipeline-ClientExample/local"
|
||||
|
||||
#SET THE PREVIOUS VARIABLE OR NOTHING WILL WORK!!!!
|
||||
#############################################################################
|
||||
@@ -19,4 +19,5 @@ export AuthorTagline="Your.Tagline.Here."
|
||||
export AuthorLogo=""
|
||||
export SourceCode="https://git.knownelement.com/reachableceo/MarkdownResume-Pipeline"
|
||||
export URLCOLOR="blue"
|
||||
export PAGEBACKGROUND="./background3.pdf"
|
||||
export PAGEBACKGROUND="./background3.pdf"
|
||||
export PANDOC_TEMPLATE="eisvogel"
|
@@ -10,7 +10,7 @@ set -euo pipefail
|
||||
#Edit the below file to reflect your information
|
||||
##################################################
|
||||
|
||||
source "./StakeholderOutputVariables.env"
|
||||
source "../StakeholderOutputVariables.env"
|
||||
|
||||
####################################################
|
||||
####################################################
|
||||
@@ -37,9 +37,9 @@ export StakeholderOutputMarkdownInputFile="$1"
|
||||
|
||||
echo "Cleaning up from previous runs..."
|
||||
|
||||
rm $BUILDYAML_STAKEHOLDER_OUTPUT
|
||||
rm $StakeholderOutputMarkdownOutputFile
|
||||
rm $StakeholderOutputPDFOutputFile
|
||||
rm $BUILDYAML_STAKEHOLDER_OUTPUT || true
|
||||
rm $StakeholderOutputMarkdownOutputFile || true
|
||||
rm $StakeholderOutputPDFOutputFile || true
|
||||
|
||||
echo "Combining markdown files into single input file for pandoc..."
|
||||
cat $StakeholderOutputMarkdownInputFile > $StakeholderOutputMarkdownOutputFile
|
||||
|
6
local/demo-data/DemoDSR.md
Normal file
6
local/demo-data/DemoDSR.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Demo Report
|
||||
|
||||
# Time log
|
||||
|
||||
1:00:
|
||||
- stuff
|
83
local/dsr-gather/dsr-gather-redmine.sh
Normal file
83
local/dsr-gather/dsr-gather-redmine.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to query Gitea API for a user's activity on a specific date
|
||||
|
||||
########################################################################################################
|
||||
#Obtain gitea api key from bitwarden
|
||||
########################################################################################################
|
||||
|
||||
####################################
|
||||
## Step 0: Set to use tsys server
|
||||
####################################
|
||||
bw logout
|
||||
|
||||
echo "Setting cli to use tsys bitwarden server..."
|
||||
bw config server https://pwvault.turnsys.com
|
||||
|
||||
####################################
|
||||
## Step 1: login to bitwarden
|
||||
####################################
|
||||
|
||||
# From: https://bitwarden.com/help/cli/#using-an-api-key
|
||||
|
||||
### Set apikey environment varaible
|
||||
|
||||
echo "Sourcing clientid/apikey data..."
|
||||
source D:/tsys/secrets/bitwarden/data/apikey-bitwarden-reachableceo
|
||||
|
||||
### Login to vault using apikey...
|
||||
|
||||
echo "Logging in..."
|
||||
bw login --apikey $BW_CLIENTID $BW_CLIENTSECRET
|
||||
|
||||
### Step 1.1: unlock / save session id
|
||||
|
||||
echo "Unlocking..."
|
||||
export BW_SESSION="$(bw unlock --passwordenv TSYS_BW_PASSWORD_REACHABLECEO --raw)"
|
||||
|
||||
|
||||
### Step 2: retrive a value into an environment variable
|
||||
|
||||
export GITEA_APIKEY="$(bw get password APIKEY-Gitea)"
|
||||
|
||||
########################################################################################################
|
||||
# Accrss gitea data
|
||||
########################################################################################################
|
||||
|
||||
# Script to query Gitea API for a user's activity on a specific date
|
||||
|
||||
# Usage: ./get_gitea_user_activity.sh <username> <date> [GITEA_URL] [TOKEN]
|
||||
|
||||
# Set username, date, and default Gitea URL
|
||||
USERNAME="${1:-reachableceo}" # Default to "reachableceo" if not provided
|
||||
DATE="${2:-$(date +%Y-%m-%d)}" # Default to today's date if not provided
|
||||
GITEA_URL="${3:-https://git.knownelement.com}" # Default Gitea URL if not provided
|
||||
TOKEN="${GITEA_APIKEY}" # Use APIKEY-GItea or passed argument
|
||||
|
||||
# API Endpoint for user activities
|
||||
API_ENDPOINT="$GITEA_URL/api/v1/users/$USERNAME/timeline"
|
||||
|
||||
# Make the API call
|
||||
if [ -n "$TOKEN" ]; then
|
||||
# If token is provided, use it in the Authorization header
|
||||
RESPONSE=$(curl -s -H "Authorization: token $TOKEN" "$API_ENDPOINT")
|
||||
else
|
||||
# If no token is provided, make an unauthenticated request
|
||||
RESPONSE=$(curl -s "$API_ENDPOINT")
|
||||
fi
|
||||
|
||||
# Check for API errors
|
||||
if [[ "$RESPONSE" == "Not found" || -z "$RESPONSE" ]]; then
|
||||
echo "Error: User '$USERNAME' not found, or endpoint is incorrect."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate JSON response
|
||||
if ! echo "$RESPONSE" | jq empty >/dev/null 2>&1; then
|
||||
echo "Error: Invalid JSON response from Gitea API."
|
||||
echo "Response: $RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Filter the activity by date using jq
|
||||
echo "$RESPONSE" | jq --arg date "$DATE" '[.[] | select(.created_at | startswith($date))]'
|
Reference in New Issue
Block a user