File tree 7 files changed +34
-12
lines changed 7 files changed +34
-12
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
Original file line number Diff line number Diff line change @@ -12,11 +12,14 @@ The UTC time when this step was run.
12
12
13
13
``` yaml
14
14
steps :
15
- - name : Get current time
16
- uses : gerred/actions/current-time@master
17
- id : current-time
18
- - name : Use current time
19
- env :
20
- TIME : " ${{ steps.current-time.outputs.time }}"
21
- run : echo $TIME
22
- ` ` `
15
+ - name : Get current time
16
+ uses : srfrnk/current-time@master
17
+ id : current-time
18
+ with :
19
+ format : YYYYMMDD
20
+ - name : Use current time
21
+ env :
22
+ TIME : " ${{ steps.current-time.outputs.time }}"
23
+ F_TIME : " ${{ steps.current-time.outputs.formattedTime }}"
24
+ run : echo $TIME $F_TIME
25
+ ` ` `
Original file line number Diff line number Diff line change @@ -4,9 +4,15 @@ description: "Get the current time with format"
4
4
branding :
5
5
icon : clock
6
6
color : blue
7
+ inputs :
8
+ format :
9
+ description : " Time format to use using [MomemtJS syntax](https://momentjs.com/)"
10
+ default : " <None>"
7
11
outputs :
8
12
time :
9
13
description : " The time this action was run"
14
+ formattedTime :
15
+ description : " The time this action was run - formatted using `format` input"
10
16
runs :
11
17
using : " node12"
12
18
main : " index.js"
Original file line number Diff line number Diff line change 1
1
const core = require ( "@actions/core" ) ;
2
2
const github = require ( "@actions/github" ) ;
3
+ var moment = require ( 'moment' ) ;
3
4
4
5
try {
5
6
const time = new Date ( ) . toISOString ( ) ;
6
7
core . setOutput ( "time" , time ) ;
8
+
9
+ const format = core . getInput ( 'format' , { required : false } ) ;
10
+ core . setOutput ( "formattedTime" , moment ( ) . format ( format ) ) ;
7
11
} catch ( error ) {
8
12
core . setFailed ( error . message ) ;
9
13
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " current-time" ,
3
- "version" : " 1.0.0a " ,
3
+ "version" : " 1.1.0 " ,
4
4
"main" : " index.js" ,
5
5
"license" : " Apache-2.0" ,
6
6
"dependencies" : {
7
7
"@actions/core" : " ^1.1.0" ,
8
- "@actions/github" : " ^1.1.0"
8
+ "@actions/github" : " ^1.1.0" ,
9
+ "momentjs" : " ^2.0.0"
9
10
}
10
11
}
Original file line number Diff line number Diff line change @@ -170,6 +170,11 @@ macos-release@^2.2.0:
170
170
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f"
171
171
integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==
172
172
173
+ momentjs@^2.0.0 :
174
+ version "2.0.0"
175
+ resolved "https://registry.yarnpkg.com/momentjs/-/momentjs-2.0.0.tgz#73df904b4fa418f6e3c605e831cef6ed5518ebd4"
176
+ integrity sha1-c9+QS0+kGPbjxgXoMc727VUY69Q=
177
+
173
178
nice-try@^1.0.4 :
174
179
version "1.0.5"
175
180
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
You can’t perform that action at this time.
0 commit comments