42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
name: "Get DateTime"
|
|
description: "Get the current date and time in a specific format."
|
|
branding:
|
|
color: "orange"
|
|
icon: "clock"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Export Date and Time"
|
|
id: date
|
|
shell: bash
|
|
run: |
|
|
for var in datetime date time atom atom_with_millis; do
|
|
value=$(date +'%Y-%m-%d %H:%M:%S')
|
|
case $var in
|
|
datetime) value=$(date +'%Y-%m-%d %H:%M:%S') ;;
|
|
date) value=$(date +'%Y-%m-%d') ;;
|
|
time) value=$(date +'%H:%M:%S') ;;
|
|
atom) value=$(date -u +'%Y-%m-%dT%H:%M:%SZ') ;;
|
|
atom_with_millis) value=$(date -u +'%Y-%m-%dT%H:%M:%S.%3NZ') ;;
|
|
esac
|
|
echo "$var=$value" | tee -a "$GITHUB_OUTPUT"
|
|
echo "${var^^}=$value" >> "$GITHUB_ENV"
|
|
done
|
|
|
|
outputs:
|
|
datetime:
|
|
description: "Current date and time in 'YYYY-MM-DD HH:MM:SS' format"
|
|
value: ${{ steps.date.outputs.datetime }}
|
|
date:
|
|
description: "Current date in 'YYYY-MM-DD' format"
|
|
value: ${{ steps.date.outputs.date }}
|
|
time:
|
|
description: "Current time in 'HH:MM:SS' format"
|
|
value: ${{ steps.date.outputs.time }}
|
|
atom:
|
|
description: "Current date and time in 'YYYY-MM-DDTHH:MM:SSZ' format"
|
|
value: ${{ steps.date.outputs.atom }}
|
|
atom_with_millis:
|
|
description: "Current date and time in 'YYYY-MM-DDTHH:MM:SS.SSSZ' format"
|
|
value: ${{ steps.date.outputs.atom_with_millis }}
|