forked from JantHsueh/get-time-action
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathaction.yml
36 lines (36 loc) · 906 Bytes
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: "Get Timestamp Action"
description: "Get the time in the specified time zone"
author: "boredland"
branding:
icon: arrow-right-circle
color: gray-dark
inputs:
timeZone:
description: "linux time zone"
required: false
default: "UTC"
format:
description: "timestamp format"
required: false
default: "YYYY-MM-DD HH:mm:ss"
outputs:
time:
description: "current time"
value: ${{ steps.time.outputs.value }}
runs:
using: "composite"
steps:
- id: time
shell: bash
env:
TZ: ${{ inputs.timeZone }}
run: |
TEMPLATE="${{ inputs.format }}"
TEMPLATE=${TEMPLATE/YYYY/%Y}
TEMPLATE=${TEMPLATE/MM/%m}
TEMPLATE=${TEMPLATE/DD/%d}
TEMPLATE=${TEMPLATE/HH/%H}
TEMPLATE=${TEMPLATE/mm/%M}
TEMPLATE=${TEMPLATE/ss/%S}
DATE=$(date +"$TEMPLATE")
echo "value=$DATE" >> $GITHUB_OUTPUT