From 7c7b46756d640ff697b49840df9b58a6f832b09c Mon Sep 17 00:00:00 2001 From: hulk510 Date: Thu, 18 Jan 2024 01:13:12 +0900 Subject: [PATCH] test4 --- dist/index.js | 9 +++++++-- src/main.ts | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 13b1ca82..0032211f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29683,15 +29683,20 @@ async function run() { // MEMO: git contextからheadRefは取得できなそう const { repo, ref } = github.context; core.info(`ref: ${ref}`); - core.info(`request: ${JSON.stringify(github.context.payload.pull_request)}`); + core.info(`payload: ${JSON.stringify(github.context.payload)}`); core.info(`number: ${JSON.stringify(github.context.payload.pull_request?.number)}`); core.info(`head ref: ${JSON.stringify(github.context.payload.pull_request?.head.ref)}`); // const eventPath = process.env.GITHUB_EVENT_PATH const headRef = process.env.GITHUB_HEAD_REF; core.info(`headRef: ${headRef}`); + const prNumber = github.context.payload.pull_request?.number; + if (prNumber) { + deleteRefActionsCache(octokit, repo, `refs/pull/${prNumber}/merge`); + } if (headRef) { - deleteRefActionsCache(octokit, repo, headRef); + deleteRefActionsCache(octokit, repo, `refs/heads/${headRef}`); } + // workflow_dispatch or push deleteRefActionsCache(octokit, repo, ref); } catch (error) { diff --git a/src/main.ts b/src/main.ts index b7551279..b5c0e3a2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -40,7 +40,7 @@ export async function run(): Promise { // MEMO: git contextからheadRefは取得できなそう const { repo, ref } = github.context core.info(`ref: ${ref}`) - core.info(`request: ${JSON.stringify(github.context.payload.pull_request)}`) + core.info(`payload: ${JSON.stringify(github.context.payload)}`) core.info( `number: ${JSON.stringify(github.context.payload.pull_request?.number)}` ) @@ -49,14 +49,20 @@ export async function run(): Promise { github.context.payload.pull_request?.head.ref )}` ) + // const eventPath = process.env.GITHUB_EVENT_PATH const headRef = process.env.GITHUB_HEAD_REF core.info(`headRef: ${headRef}`) + const prNumber = github.context.payload.pull_request?.number + if (prNumber) { + deleteRefActionsCache(octokit, repo, `refs/pull/${prNumber}/merge`) + } if (headRef) { - deleteRefActionsCache(octokit, repo, headRef) + deleteRefActionsCache(octokit, repo, `refs/heads/${headRef}`) } + // workflow_dispatch or push deleteRefActionsCache(octokit, repo, ref) } catch (error) { // Fail the workflow run if an error occurs