Skip to content

Commit ca8df1d

Browse files
committed
feat&chore: add utcOffset
1 parent 5a4163a commit ca8df1d

File tree

723 files changed

+5689
-133786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

723 files changed

+5689
-133786
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
name: Test all actions
2-
on: push
1+
name: Test the action
2+
on:
3+
push:
4+
branches:
5+
- master
36
jobs:
47
build:
58
runs-on: ubuntu-latest
69
steps:
710
- name: Get current time
8-
uses: gerred/actions/current-time@master
11+
uses: 1466587594/get-current-time@master
912
id: current-time
13+
with:
14+
format: YYYYMMDD-HH
15+
utcOffset: "+08:00"
1016
- name: Use current time
1117
env:
1218
TIME: "${{ steps.current-time.outputs.time }}"
13-
run: echo $TIME
19+
F_TIME: "${{ steps.current-time.outputs.formattedTime }}"
20+
run: echo $TIME $F_TIME

.gitignore

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,107 @@
1-
node_modules
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and not Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
# Stores VSCode versions used for testing VSCode extensions
107+
.vscode-test

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
# Current Time Javascript Action
1+
# Get Current Time Github Action
22

3-
This action sets the current ISO8601 time to the `time` output. Useful for setting build times in subsequent steps, or keeping the same recorded time for the entire workflow.
3+
This action sets the current ISO8601 time to the `time` output. Useful for setting build times in subsequent steps, rename your artifact, or keeping the same recorded time for the entire workflow.
44

55
## Inputs
66

77
### `format`
88

9-
Time format to use - using [MomentJS syntax](https://momentjs.com/docs/#/displaying/) - optional
9+
Time format to use - using [MomemtJS format syntax](https://momentjs.com/docs/#/displaying/format/) - optional
10+
11+
### `utcOffset`
12+
13+
UTC time offset to use - using [MomemtJS utcOffset syntax](https://momentjs.com/docs/#/manipulating/utc-offset/) - optional
1014

1115
## Outputs
1216

@@ -23,10 +27,11 @@ The UTC time when this step was run - formatted using `format` input.
2327
```yaml
2428
steps:
2529
- name: Get current time
26-
uses: srfrnk/current-time@master
30+
uses: 1466587594/get-current-time@v1
2731
id: current-time
2832
with:
29-
format: YYYYMMDD
33+
format: YYYYMMDD-HH
34+
utcOffset: "+08:00"
3035
- name: Use current time
3136
env:
3237
TIME: "${{ steps.current-time.outputs.time }}"

action.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ function action() {
77
core.setOutput("time", time);
88

99
const format = core.getInput('format', { required: false });
10-
core.setOutput("formattedTime", moment().format(format));
10+
const utcOffset = core.getInput('utcOffset', { required: false });
11+
core.setOutput("formattedTime", moment().utcOffset(utcOffset).format(format));
1112
} catch (error) {
1213
core.setFailed(error.message);
1314
}

action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
name: "Current Time 2"
2-
author: "Gerred Dillon <hello@gerred.org>, Shahar Frank<srfrnk@gmail.com>"
3-
description: "Get the current time with format"
1+
name: "Get Current Time"
2+
author: "Gerred Dillon <hello@gerred.org>, Shahar Frank <srfrnk@gmail.com>, Joshua Chan <josStorer@outlook.com>"
3+
description: "Get the current time with format and utcOffset"
44
branding:
55
icon: clock
66
color: blue
77
inputs:
88
format:
9-
description: "Time format to use using [MomemtJS syntax](https://momentjs.com/)"
10-
default: "<None>"
9+
description: "Time format to use using [MomemtJS format syntax](https://momentjs.com/docs/#/displaying/format/)"
10+
required: false
11+
utcOffset:
12+
description: "UTC time offset to use using [MomemtJS utcOffset syntax](https://momentjs.com/docs/#/manipulating/utc-offset/)"
13+
required: false
1114
outputs:
1215
time:
1316
description: "The time this action was run"
1417
formattedTime:
15-
description: "The time this action was run - formatted using `format` input"
18+
description: "The time this action was run - formatted using `format` and `utcOffset` input"
1619
runs:
1720
using: "node12"
1821
main: "index.js"

0 commit comments

Comments
 (0)