Skip to content

feat: add method to get commit date from git#489

Merged
crazy-max merged 1 commit intodocker:mainfrom
trim21:get-commit-data
Nov 13, 2024
Merged

feat: add method to get commit date from git#489
crazy-max merged 1 commit intodocker:mainfrom
trim21:get-commit-data

Conversation

@trim21
Copy link
Copy Markdown
Contributor

@trim21 trim21 commented Nov 10, 2024

for docker/metadata-action#308

sorry to create this PR again, I did some force push and it cause github not working as expected.

and looks like ci failed with other tests, not caused be this PR?

Comment thread src/git.ts Outdated
Comment on lines +167 to +169
public static async commitDate(ref: string, gitDir: string | undefined = undefined): Promise<Date> {
const args = ['show', '-s', '--format="%ci"', ref];
if (gitDir !== undefined) {
args.push('--');
args.push(gitDir);
}

return new Date(await Git.exec(args));
}
Copy link
Copy Markdown
Member

@crazy-max crazy-max Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need a gitDir opt like other methods we have:

  public static async commitDate(ref: string): Promise<Date> {
    return new Date(await Git.exec(['show', '-s', '--format="%ci"', ref]));
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Trim21 <trim21.me@gmail.com>
Copy link
Copy Markdown
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@crazy-max crazy-max merged commit 8672cc7 into docker:main Nov 13, 2024
@trim21 trim21 deleted the get-commit-data branch November 13, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants