-
Notifications
You must be signed in to change notification settings - Fork 1
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
Populate pull request commit details and update packages #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TY, @terryknowlton .
Few Qs.
const head = pullRequestEvent.head; | ||
const user = head.user; | ||
setVariable(EnvironmentVariables.CI_COMMIT_ID, head.sha); | ||
setVariable(EnvironmentVariables.CI_COMMITTER_USERNAME, user.login); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a diff b/t username
for push
and login
here for the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unfortunately the models are different for the various event types.
PushEvent.head_commit gives us a nullable Commit object which has an author: Committer
object (there is also a PushEvent.pusher: Committer
that I'm guessing has the same Committer object). The committer object then has
/**
* For pushes where `after` is or points to a commit object, an expanded representation of that commit. For pushes where `after` refers to an annotated tag object, an expanded representation of the commit pointed to by the annotated tag.
*/
export interface PushEvent {
...
head_commit: Commit | null;
...
}
export interface Commit {
...
author: Committer
...
}
export interface Committer {
/**
* The git author's name.
*/
name: string;
/**
* The git author's email address.
*/
email: string | null;
date?: string;
username?: string;
}
PullRequest does not have any Commit object except for an array of them to list all commits on the PR and a User object with the triggering user for the latest commit. The PullRequest.head
field provides an object with some of the commit info like the sha and the user information but not the message.
export interface PullRequest {
...
user: User;
head: {
label: string;
ref: string;
sha: string;
user: User;
repo: Repository | null;
};
...
}
export interface User {
login: string;
id: number;
node_id: string;
name?: string;
email?: string | null;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: "Bot" | "User" | "Organization";
site_admin: boolean;
}
Co-authored-by: Joe Lust <[email protected]>
…deship-env-adapter into populate-pr-event-details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @terryknowlton ❤️
One more ask: can we explain this extra functionality in the README.md? (e.g. overall and for that specific field).
Enhancements to include
CI-*
details from pull_request event triggers. Also updates dependencies to latest versions