Skip to content

Commit ecb3292

Browse files
authored
feat: uses 2 dots compare syntax for push diff (#1030)
1 parent 046435d commit ecb3292

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ with:
137137

138138
Show only new issues.
139139

140-
If you are using `merge_group` event (merge queue) you should add the option `fetch-depth: 0` to `actions/checkout` step.
141-
142140
The default value is `false`.
143141

144142
```yml
@@ -148,6 +146,11 @@ with:
148146
# ...
149147
```
150148

149+
* `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`.
150+
* `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`.
151+
* `merge_group`: the action gets the diff by using `--new-from-rev` option (relies on git).
152+
You should add the option `fetch-depth: 0` to `actions/checkout` step.
153+
151154
### `working-directory`
152155

153156
(optional)

dist/post_run/index.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/run/index.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/run.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ async function fetchPushPatch(ctx: Context): Promise<string> {
104104

105105
let patch: string
106106
try {
107-
const patchResp = await octokit.rest.repos.compareCommits({
107+
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
108108
owner: ctx.repo.owner,
109109
repo: ctx.repo.repo,
110-
base: ctx.payload.before,
111-
head: ctx.payload.after,
110+
basehead: `${ctx.payload.before}..${ctx.payload.after}`,
112111
mediaType: {
113112
format: `diff`,
114113
},

0 commit comments

Comments
 (0)