Skip to content

Commit

Permalink
fix timestamp format
Browse files Browse the repository at this point in the history
  • Loading branch information
kengo-k committed Jun 1, 2024
1 parent f3d7f2c commit e56cda2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import github from '@actions/github';
import { load } from 'js-yaml';
import { z } from 'zod';
import { Octokit } from '@octokit/rest';
import { format } from 'date-fns';

const schema = z.object({
path: z.string(),
Expand Down Expand Up @@ -52,7 +53,9 @@ async function main() {
imageTags.push(argObj.branch);
}
if (argObj.with_timestamp) {
imageTags.push(new Date().toISOString());
const now = new Date();
const formattedDate = format(now, 'yyyyMMddHHmm');
imageTags.push(formattedDate);
}
if (argObj.with_commit_sha) {
imageTags.push(after);
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@octokit/rest": "^20.1.1",
"date-fns": "^3.6.0",
"js-yaml": "^4.1.0",
"zod": "^3.23.8"
}
Expand Down

0 comments on commit e56cda2

Please sign in to comment.