From ff345452cf1f657e4ff75def67a7c5dbe4b28137 Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:48:57 -0800 Subject: [PATCH 1/6] Update Output --- dist/index.js | 8 +++++--- src/index.ts | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1bb2e95..4487e36 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31574,13 +31574,15 @@ async function main() { const repository = await api.getRepository(data); data.base = repository.default_branch; } - console.log('data:', data); + coreExports.startGroup('Request data'); + console.log(data); + coreExports.endGroup(); coreExports.info('⌛ Creating Pull Request...'); const pull = await api.createPull(data); - coreExports.startGroup('pull'); + coreExports.startGroup('Response data'); console.log(JSON.stringify(pull, null, 2)); coreExports.endGroup(); - coreExports.info(`🚀 Pull Request Created: ${pull.number}`); + coreExports.info(`🚀 Pull Request Created: ${pull.html_url}`); if (inputs.summary) { coreExports.info('📝 Writing Job Summary'); try { diff --git a/src/index.ts b/src/index.ts index 8448e9d..bb00b3f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -47,15 +47,17 @@ async function main() { const repository = await api.getRepository(data) data.base = repository.default_branch } - console.log('data:', data) + core.startGroup('Request data') + console.log(data) + core.endGroup() // data // Processing core.info('⌛ Creating Pull Request...') const pull = await api.createPull(data) - core.startGroup('pull') + core.startGroup('Response data') console.log(JSON.stringify(pull, null, 2)) core.endGroup() // pull - core.info(`🚀 Pull Request Created: ${pull.number}`) + core.info(`🚀 Pull Request Created: ${pull.html_url}`) // Summary if (inputs.summary) { From e8fe5e61c7b07aa43664c34b4079388b58818b7b Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:56:55 -0800 Subject: [PATCH 2/6] Update Test --- .github/workflows/test.yaml | 39 ++++++++++++++++++++++++------------- dist/index.js | 3 ++- src/github.ts | 4 +++- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 10045f9..e7f3855 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,24 +46,37 @@ jobs: continue-on-error: true run: env + #- name: "Cleanup PR" + # continue-on-error: true + # env: + # GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} + # run: | + # pull="$(gh api /repos/${{ env.repository }}/pulls \ + # -H "Accept: application/vnd.github+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # --jq '.[0].number' + # )" + # [ -z "${pull}" ] && exit 0 + # echo "Closing PR: ${pull}" + # gh api --method PATCH "/repos/${{ env.repository }}/pulls/${pull}" \ + # -H "Accept: application/vnd.github+json" \ + # -H "X-GitHub-Api-Version: 2022-11-28" \ + # -f "state=closed" --silent + # echo "Waiting 3 Seconds..." + # sleep 3 + - name: "Cleanup PR" continue-on-error: true env: GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} run: | - pull="$(gh api /repos/${{ env.repository }}/pulls \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - --jq '.[0].number' - )" - [ -z "${pull}" ] && exit 0 - echo "Closing PR: ${pull}" - gh api --method PATCH "/repos/${{ env.repository }}/pulls/${pull}" \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - -f "state=closed" --silent - echo "Waiting 3 Seconds..." - sleep 3 + number="$(gh pr list --repo "${{ env.repository }}" --json number --template '{{(index . 0).number}}')" + [ -n "${number}" ];then + echo "Closing Pull Request: ${number}" + gh pr close --repo "${{ env.repository }}" "${number}" + echo "Waiting 3 Seconds..." + sleep 3 + fi - name: "Test Local Action" id: test diff --git a/dist/index.js b/dist/index.js index 4487e36..04742b4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31528,11 +31528,12 @@ class GitHub { this.octokit = githubExports.getOctokit(token); } async createPull(data) { - console.log('createPull:', data); + coreExports.debug(`createPull: ${JSON.stringify(data)}`); const response = await this.octokit.rest.pulls.create(data); return response.data; } async getRepository(data) { + coreExports.debug(`getRepository: ${JSON.stringify(data)}`); const response = await this.octokit.rest.repos.get(data); return response.data; } diff --git a/src/github.ts b/src/github.ts index 9c55637..613d321 100644 --- a/src/github.ts +++ b/src/github.ts @@ -1,3 +1,4 @@ +import * as core from '@actions/core' import * as github from '@actions/github' import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.js' @@ -14,12 +15,13 @@ export class GitHub { } async createPull(data: PullRequest) { - console.log('createPull:', data) + core.debug(`createPull: ${JSON.stringify(data)}`) const response = await this.octokit.rest.pulls.create(data) return response.data } async getRepository(data: { owner: string; repo: string }) { + core.debug(`getRepository: ${JSON.stringify(data)}`) const response = await this.octokit.rest.repos.get(data) return response.data } From ded7816b399ea1d231d7c534a5f193452b925f5a Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:57:45 -0800 Subject: [PATCH 3/6] Update Test --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e7f3855..906e8c5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -71,7 +71,7 @@ jobs: GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} run: | number="$(gh pr list --repo "${{ env.repository }}" --json number --template '{{(index . 0).number}}')" - [ -n "${number}" ];then + if [ -n "${number}" ];then echo "Closing Pull Request: ${number}" gh pr close --repo "${{ env.repository }}" "${number}" echo "Waiting 3 Seconds..." From ee2c6002be108e7bf3b457a0bff2988dd22c4dd3 Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:12:09 -0800 Subject: [PATCH 4/6] Cleanup --- .github/workflows/test.yaml | 25 ++----------------------- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 906e8c5..f2365a7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,27 +46,7 @@ jobs: continue-on-error: true run: env - #- name: "Cleanup PR" - # continue-on-error: true - # env: - # GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} - # run: | - # pull="$(gh api /repos/${{ env.repository }}/pulls \ - # -H "Accept: application/vnd.github+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # --jq '.[0].number' - # )" - # [ -z "${pull}" ] && exit 0 - # echo "Closing PR: ${pull}" - # gh api --method PATCH "/repos/${{ env.repository }}/pulls/${pull}" \ - # -H "Accept: application/vnd.github+json" \ - # -H "X-GitHub-Api-Version: 2022-11-28" \ - # -f "state=closed" --silent - # echo "Waiting 3 Seconds..." - # sleep 3 - - name: "Cleanup PR" - continue-on-error: true env: GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} run: | @@ -76,6 +56,8 @@ jobs: gh pr close --repo "${{ env.repository }}" "${number}" echo "Waiting 3 Seconds..." sleep 3 + else + echo "No PR's found: ${{ github.server_url }}/${{ env.repository }}/pulls" fi - name: "Test Local Action" @@ -84,9 +66,6 @@ jobs: with: repository: ${{ env.repository }} head: test1 - #base: master - #title: Ralf Broke It - #body: Broken ${{ github.run_number }} times. token: ${{ secrets.TEST_PULL_TOKEN }} - name: "Validate Outputs" diff --git a/package-lock.json b/package-lock.json index a2f0152..ae50eff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-typescript": "^12.3.0", - "@types/node": "^25.0.3", + "@types/node": "^25.0.5", "@typescript-eslint/eslint-plugin": "^8.52.0", "@typescript-eslint/parser": "^8.52.0", "eslint": "^9.39.2", @@ -956,9 +956,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.0.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.3.tgz", - "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", + "version": "25.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.5.tgz", + "integrity": "sha512-FuLxeLuSVOqHPxSN1fkcD8DLU21gAP7nCKqGRJ/FglbCUBs0NYN6TpHcdmyLeh8C0KwGIaZQJSv+OYG+KZz+Gw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 28f7ba9..8cd77d3 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-typescript": "^12.3.0", - "@types/node": "^25.0.3", + "@types/node": "^25.0.5", "@typescript-eslint/eslint-plugin": "^8.52.0", "@typescript-eslint/parser": "^8.52.0", "eslint": "^9.39.2", From 70e4fb42d61f9b9250d4568e681f0c79444275ee Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:15:22 -0800 Subject: [PATCH 5/6] Cleanup --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f2365a7..c1350b9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,7 +50,7 @@ jobs: env: GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} run: | - number="$(gh pr list --repo "${{ env.repository }}" --json number --template '{{(index . 0).number}}')" + number="$(gh pr list --repo "${{ env.repository }}" --json number --template '{{if gt (len .) 0}}{{(index . 0).number}}{{end}}')" if [ -n "${number}" ];then echo "Closing Pull Request: ${number}" gh pr close --repo "${{ env.repository }}" "${number}" From 47eace81f206c5b5584240ede135e111b058094e Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:17:05 -0800 Subject: [PATCH 6/6] Cleanup --- .github/workflows/test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c1350b9..6a59416 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,7 +50,10 @@ jobs: env: GH_TOKEN: ${{ secrets.TEST_PULL_TOKEN }} run: | - number="$(gh pr list --repo "${{ env.repository }}" --json number --template '{{if gt (len .) 0}}{{(index . 0).number}}{{end}}')" + number="$(gh pr list \ + --repo "${{ env.repository }}" --json number \ + --template '{{if gt (len .) 0}}{{(index . 0).number}}{{end}}' \ + )" if [ -n "${number}" ];then echo "Closing Pull Request: ${number}" gh pr close --repo "${{ env.repository }}" "${number}"