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: uses 2 dots compare syntax for push diff #1030

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading