Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

trim21
Copy link
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?

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
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
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
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
48 checks passed
@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