Skip to content

Commit

Permalink
feat: uses 2 dots compare syntax for push diff (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 4, 2024
1 parent 046435d commit ecb3292
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -137,8 +137,6 @@ with:

Show only new issues.

If you are using `merge_group` event (merge queue) you should add the option `fetch-depth: 0` to `actions/checkout` step.

The default value is `false`.

```yml
Expand All @@ -148,6 +146,11 @@ with:
# ...
```

* `pull_request` and `pull_request_target`: the action gets the diff of the PR content from the [GitHub API](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request) and use it with `--new-from-patch`.
* `push`: the action gets the diff of the push content (difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and use it with `--new-from-patch`.
* `merge_group`: the action gets the diff by using `--new-from-rev` option (relies on git).
You should add the option `fetch-depth: 0` to `actions/checkout` step.

### `working-directory`

(optional)
Expand Down
5 changes: 2 additions & 3 deletions dist/post_run/index.js

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

5 changes: 2 additions & 3 deletions dist/run/index.js

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

5 changes: 2 additions & 3 deletions src/run.ts
Expand Up @@ -104,11 +104,10 @@ async function fetchPushPatch(ctx: Context): Promise<string> {

let patch: string
try {
const patchResp = await octokit.rest.repos.compareCommits({
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
owner: ctx.repo.owner,
repo: ctx.repo.repo,
base: ctx.payload.before,
head: ctx.payload.after,
basehead: `${ctx.payload.before}..${ctx.payload.after}`,
mediaType: {
format: `diff`,
},
Expand Down

0 comments on commit ecb3292

Please sign in to comment.