Skip to content

Commit

Permalink
feat&chore: add utcOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Mar 2, 2020
1 parent 5a4163a commit ca8df1d
Show file tree
Hide file tree
Showing 723 changed files with 5,689 additions and 133,786 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: Test all actions
on: push
name: Test the action
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get current time
uses: gerred/actions/current-time@master
uses: 1466587594/get-current-time@master
id: current-time
with:
format: YYYYMMDD-HH
utcOffset: "+08:00"
- name: Use current time
env:
TIME: "${{ steps.current-time.outputs.time }}"
run: echo $TIME
F_TIME: "${{ steps.current-time.outputs.formattedTime }}"
run: echo $TIME $F_TIME
108 changes: 107 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,107 @@
node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Current Time Javascript Action
# Get Current Time Github Action

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.
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.

## Inputs

### `format`

Time format to use - using [MomentJS syntax](https://momentjs.com/docs/#/displaying/) - optional
Time format to use - using [MomemtJS format syntax](https://momentjs.com/docs/#/displaying/format/) - optional

### `utcOffset`

UTC time offset to use - using [MomemtJS utcOffset syntax](https://momentjs.com/docs/#/manipulating/utc-offset/) - optional

## Outputs

Expand All @@ -23,10 +27,11 @@ The UTC time when this step was run - formatted using `format` input.
```yaml
steps:
- name: Get current time
uses: srfrnk/current-time@master
uses: 1466587594/get-current-time@v1
id: current-time
with:
format: YYYYMMDD
format: YYYYMMDD-HH
utcOffset: "+08:00"
- name: Use current time
env:
TIME: "${{ steps.current-time.outputs.time }}"
Expand Down
3 changes: 2 additions & 1 deletion action.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function action() {
core.setOutput("time", time);

const format = core.getInput('format', { required: false });
core.setOutput("formattedTime", moment().format(format));
const utcOffset = core.getInput('utcOffset', { required: false });
core.setOutput("formattedTime", moment().utcOffset(utcOffset).format(format));
} catch (error) {
core.setFailed(error.message);
}
Expand Down
15 changes: 9 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: "Current Time 2"
author: "Gerred Dillon <[email protected]>, Shahar Frank<[email protected]>"
description: "Get the current time with format"
name: "Get Current Time"
author: "Gerred Dillon <[email protected]>, Shahar Frank <srfrnk@gmail.com>, Joshua Chan <josStorer@outlook.com>"
description: "Get the current time with format and utcOffset"
branding:
icon: clock
color: blue
inputs:
format:
description: "Time format to use using [MomemtJS syntax](https://momentjs.com/)"
default: "<None>"
description: "Time format to use using [MomemtJS format syntax](https://momentjs.com/docs/#/displaying/format/)"
required: false
utcOffset:
description: "UTC time offset to use using [MomemtJS utcOffset syntax](https://momentjs.com/docs/#/manipulating/utc-offset/)"
required: false
outputs:
time:
description: "The time this action was run"
formattedTime:
description: "The time this action was run - formatted using `format` input"
description: "The time this action was run - formatted using `format` and `utcOffset` input"
runs:
using: "node12"
main: "index.js"
Loading

0 comments on commit ca8df1d

Please sign in to comment.