Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Set Node.js 24.x
uses: actions/setup-node@v6.4.0
uses: actions/setup-node@v7.0.0
with:
node-version: 24.x

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6.0.3
uses: actions/checkout@v7.0.1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4.36.2
uses: github/codeql-action/init@v4.37.7
with:
languages: ${{ matrix.language }}
source-root: src
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v4.36.2
uses: github/codeql-action/autobuild@v4.37.7

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4.36.2
uses: github/codeql-action/analyze@v4.37.7
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
- uses: actions/checkout@v7.0.1
- run: |
npm install
- run: |
Expand Down
26 changes: 18 additions & 8 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as path from 'path'

import * as exec from '@actions/exec'
import * as github from '@actions/github'
import * as httpClient from '@actions/http-client'
import {expect, test} from '@jest/globals'

import {CreatePullRequest} from '../src/create-pull-request.js'
Expand All @@ -17,7 +16,6 @@ const repo: string = process.env.TEST_GITHUB_REPO!

const skipIntegration = !token || !owner || !repo
const integrationTest = skipIntegration ? test.skip : test
const http: httpClient.HttpClient = new httpClient.HttpClient()

function removeIndex(diff: string): string {
return diff
Expand All @@ -26,15 +24,24 @@ function removeIndex(diff: string): string {
.join('\n')
}

async function checkDiff(prNum: number, exceptDiff: string) {
async function checkDiff(
octokit: ReturnType<typeof github.getOctokit>,
prNum: number,
exceptDiff: string
) {
const deadline = Date.now() + 15 * 1000
let diff = ''
while (Date.now() < deadline) {
diff = await (
await http.get(
`https://patch-diff.githubusercontent.com/raw/${owner}/${repo}/pull/${prNum}.diff`
)
).readBody()
// Fetch the diff through the authenticated API (rather than the
// unauthenticated patch-diff.githubusercontent.com endpoint) so this
// also works against private repositories.
const response = await octokit.rest.pulls.get({
owner,
repo,
pull_number: prNum,
mediaType: {format: 'diff'}
})
diff = response.data as unknown as string
if (removeIndex(diff) === exceptDiff) {
break
}
Expand Down Expand Up @@ -81,6 +88,7 @@ integrationTest(
commitSha: commit
})
await checkDiff(
octokit,
num,
[
'diff --git a/dir/test b/dir/test',
Expand Down Expand Up @@ -139,6 +147,7 @@ integrationTest(
})

await checkDiff(
octokit,
num,
[
'diff --git a/test b/test',
Expand Down Expand Up @@ -200,6 +209,7 @@ integrationTest(
commitSha: commit
})
await checkDiff(
octokit,
num,
[
'diff --git a/test b/test',
Expand Down
Loading
Loading