Merge pull request #475 from crazy-max/commit-date-changes
Some checks failed
ci / context (git) (push) Failing after 0s
ci / context (workflow) (push) Failing after 0s
ci / multi-images (push) Failing after 0s
ci / tag-schedule () (push) Failing after 0s
ci / tag-schedule (cron-{{date 'YYYYMMDD'}}) (push) Failing after 0s
ci / tag-schedule (schedule) (push) Failing after 0s
ci / tag-schedule ({{date 'YYYYMMDD-HHmmss'}}) (push) Failing after 0s
ci / tag-match (\d.\d, 0) (push) Failing after 0s
ci / tag-match (\d.\d.\d, 0) (push) Failing after 0s
ci / tag-match (v(.*), 1) (push) Failing after 0s
ci / tag-semver (auto) (push) Failing after 0s
ci / tag-semver (false) (push) Failing after 0s
ci / tag-semver (true) (push) Failing after 0s
ci / flavor (push) Failing after 0s
ci / images (push) Failing after 0s
ci / custom-labels-annotations (push) Failing after 0s
ci / global-exps (push) Failing after 0s
ci / json (push) Failing after 0s
ci / docker-push (push) Failing after 0s
ci / bake (push) Failing after 0s
ci / sep-tags ( ) (push) Failing after 0s
ci / sep-tags (,) (push) Failing after 0s
ci / output-env (push) Failing after 0s
ci / bake-annotations (push) Failing after 0s
ci / no-images (push) Failing after 0s
ci / bake-cwd (push) Failing after 0s
ci / sha-short () (push) Failing after 0s
ci / sha-short (16) (push) Failing after 0s
ci / dump (push) Failing after 0s
Some checks failed
ci / context (git) (push) Failing after 0s
ci / context (workflow) (push) Failing after 0s
ci / multi-images (push) Failing after 0s
ci / tag-schedule () (push) Failing after 0s
ci / tag-schedule (cron-{{date 'YYYYMMDD'}}) (push) Failing after 0s
ci / tag-schedule (schedule) (push) Failing after 0s
ci / tag-schedule ({{date 'YYYYMMDD-HHmmss'}}) (push) Failing after 0s
ci / tag-match (\d.\d, 0) (push) Failing after 0s
ci / tag-match (\d.\d.\d, 0) (push) Failing after 0s
ci / tag-match (v(.*), 1) (push) Failing after 0s
ci / tag-semver (auto) (push) Failing after 0s
ci / tag-semver (false) (push) Failing after 0s
ci / tag-semver (true) (push) Failing after 0s
ci / flavor (push) Failing after 0s
ci / images (push) Failing after 0s
ci / custom-labels-annotations (push) Failing after 0s
ci / global-exps (push) Failing after 0s
ci / json (push) Failing after 0s
ci / docker-push (push) Failing after 0s
ci / bake (push) Failing after 0s
ci / sep-tags ( ) (push) Failing after 0s
ci / sep-tags (,) (push) Failing after 0s
ci / output-env (push) Failing after 0s
ci / bake-annotations (push) Failing after 0s
ci / no-images (push) Failing after 0s
ci / bake-cwd (push) Failing after 0s
ci / sha-short () (push) Failing after 0s
ci / sha-short (16) (push) Failing after 0s
ci / dump (push) Failing after 0s
commit_date: code cleanup and readme updates
This commit is contained in:
@@ -45,6 +45,7 @@ ___
|
||||
* [`{{base_ref}}`](#base_ref)
|
||||
* [`{{is_default_branch}}`](#is_default_branch)
|
||||
* [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone)
|
||||
* [`{{commit_date '<format>' tz='<timezone>'}}`](#commit_date-format-tztimezone)
|
||||
* [Major version zero](#major-version-zero)
|
||||
* [JSON output object](#json-output-object)
|
||||
* [Overwrite labels and annotations](#overwrite-labels-and-annotations)
|
||||
@@ -891,13 +892,14 @@ Default `tz` is UTC.
|
||||
|
||||
#### `{{commit_date '<format>' tz='<timezone>'}}`
|
||||
|
||||
Returns the date when current git commit is committed.
|
||||
rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/).
|
||||
Returns the date when the current git commit is committed, rendered by its
|
||||
[moment format](https://momentjs.com/docs/#/displaying/format/). It falls back
|
||||
to the current date if the commit date is not available.
|
||||
|
||||
Default `tz` is UTC.
|
||||
|
||||
| Expression | Output example |
|
||||
|----------------------------------------------|-----------------------------------------|
|
||||
|-----------------------------------------------------|-----------------------------------------|
|
||||
| `{{commit_date 'YYYYMMDD'}}` | `20200110` |
|
||||
| `{{commit_date 'dddd, MMMM Do YYYY, h:mm:ss a'}}` | `Friday, January 10th 2020, 3:25:50 pm` |
|
||||
| `{{commit_date 'YYYYMMDD-HHmmss' tz='Asia/Tokyo'}}` | `20200110-093000` |
|
||||
|
||||
@@ -5,9 +5,9 @@ import * as path from 'path';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {Git} from '@docker/actions-toolkit/lib/git';
|
||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
|
||||
import {ContextSource, getContext, getInputs, Inputs} from '../src/context';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
|
||||
const toolkit = new Toolkit({githubToken: 'fake-github-token'});
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as dotenv from 'dotenv';
|
||||
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
|
||||
import {ContextSource, getContext, getInputs, Inputs} from '../src/context';
|
||||
import {Meta, Version} from '../src/meta';
|
||||
|
||||
Reference in New Issue
Block a user