Skip to content

Commit

Permalink
fix: use before and after from push events
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Sep 6, 2021
1 parent da8c1a5 commit 0e26874
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package-lock.json

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

5 changes: 4 additions & 1 deletion src/run-nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as github from '@actions/github';
// eslint-disable-next-line import/no-unresolved
import { PullRequest } from '@octokit/webhooks-types';
import { PullRequest, PushEvent } from '@octokit/webhooks-types';

import { CommandWrapper } from './command-builder';
import { Inputs } from './inputs';
Expand All @@ -11,6 +11,9 @@ async function retrieveGitBoundaries(): Promise<[base: string, head: string]> {
if (github.context.eventName === 'pull_request') {
const prPayload = github.context.payload.pull_request as PullRequest;
return [prPayload.base.sha, prPayload.head.sha];
} else if (github.context.eventName === 'push') {
const pushPayload = github.context.payload as PushEvent;
return [pushPayload.before, pushPayload.after];
} else {
let base = '';
await exec.exec('git', ['rev-parse', 'HEAD~1'], {
Expand Down

0 comments on commit 0e26874

Please sign in to comment.