feat: add support for running on release event (#1191)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
96fd19710a
commit
043929ee8f
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
@ -213,7 +213,8 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
|
|||||||
if (isShallow) {
|
if (isShallow) {
|
||||||
core.info('Repository is shallow, fetching more history...');
|
core.info('Repository is shallow, fetching more history...');
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '');
|
const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') ||
|
||||||
|
env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH;
|
||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
@ -568,7 +569,7 @@ exports.getEnv = void 0;
|
|||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const getEnv = () => __awaiter(void 0, void 0, void 0, function* () {
|
const getEnv = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||||
const eventPath = process.env.GITHUB_EVENT_PATH;
|
const eventPath = process.env.GITHUB_EVENT_PATH;
|
||||||
let eventJson = {};
|
let eventJson = {};
|
||||||
if (eventPath) {
|
if (eventPath) {
|
||||||
@ -581,9 +582,10 @@ const getEnv = () => __awaiter(void 0, void 0, void 0, function* () {
|
|||||||
GITHUB_EVENT_PULL_REQUEST_BASE_REF: ((_d = (_c = eventJson.pull_request) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.ref) || '',
|
GITHUB_EVENT_PULL_REQUEST_BASE_REF: ((_d = (_c = eventJson.pull_request) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.ref) || '',
|
||||||
GITHUB_EVENT_BEFORE: eventJson.before || '',
|
GITHUB_EVENT_BEFORE: eventJson.before || '',
|
||||||
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
|
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
|
||||||
GITHUB_EVENT_HEAD_REPO_FORK: ((_e = eventJson.head_repo) === null || _e === void 0 ? void 0 : _e.fork) || '',
|
GITHUB_EVENT_RELEASE_TARGET_COMMITISH: ((_e = eventJson.release) === null || _e === void 0 ? void 0 : _e.target_commitish) || '',
|
||||||
GITHUB_EVENT_PULL_REQUEST_NUMBER: ((_f = eventJson.pull_request) === null || _f === void 0 ? void 0 : _f.number) || '',
|
GITHUB_EVENT_HEAD_REPO_FORK: ((_f = eventJson.head_repo) === null || _f === void 0 ? void 0 : _f.fork) || '',
|
||||||
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ((_h = (_g = eventJson.pull_request) === null || _g === void 0 ? void 0 : _g.base) === null || _h === void 0 ? void 0 : _h.sha) || '',
|
GITHUB_EVENT_PULL_REQUEST_NUMBER: ((_g = eventJson.pull_request) === null || _g === void 0 ? void 0 : _g.number) || '',
|
||||||
|
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ((_j = (_h = eventJson.pull_request) === null || _h === void 0 ? void 0 : _h.base) === null || _j === void 0 ? void 0 : _j.sha) || '',
|
||||||
GITHUB_EVENT_FORCED: eventJson.forced || '',
|
GITHUB_EVENT_FORCED: eventJson.forced || '',
|
||||||
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
|
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
|
||||||
GITHUB_REF: process.env.GITHUB_REF || '',
|
GITHUB_REF: process.env.GITHUB_REF || '',
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -83,7 +83,9 @@ export const getSHAForPushEvent = async (
|
|||||||
core.info('Repository is shallow, fetching more history...')
|
core.info('Repository is shallow, fetching more history...')
|
||||||
|
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '')
|
const sourceBranch =
|
||||||
|
env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') ||
|
||||||
|
env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH
|
||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
|
@ -8,6 +8,7 @@ export type Env = {
|
|||||||
GITHUB_REF_NAME: string
|
GITHUB_REF_NAME: string
|
||||||
GITHUB_REF: string
|
GITHUB_REF: string
|
||||||
GITHUB_EVENT_BASE_REF: string
|
GITHUB_EVENT_BASE_REF: string
|
||||||
|
GITHUB_EVENT_RELEASE_TARGET_COMMITISH: string
|
||||||
GITHUB_EVENT_HEAD_REPO_FORK: string
|
GITHUB_EVENT_HEAD_REPO_FORK: string
|
||||||
GITHUB_WORKSPACE: string
|
GITHUB_WORKSPACE: string
|
||||||
GITHUB_EVENT_FORCED: string
|
GITHUB_EVENT_FORCED: string
|
||||||
@ -27,6 +28,9 @@ type GithubEvent = {
|
|||||||
}
|
}
|
||||||
number: string
|
number: string
|
||||||
}
|
}
|
||||||
|
release?: {
|
||||||
|
target_commitish: string
|
||||||
|
}
|
||||||
before?: string
|
before?: string
|
||||||
base_ref?: string
|
base_ref?: string
|
||||||
head_repo?: {
|
head_repo?: {
|
||||||
@ -49,6 +53,8 @@ export const getEnv = async (): Promise<Env> => {
|
|||||||
GITHUB_EVENT_PULL_REQUEST_BASE_REF: eventJson.pull_request?.base?.ref || '',
|
GITHUB_EVENT_PULL_REQUEST_BASE_REF: eventJson.pull_request?.base?.ref || '',
|
||||||
GITHUB_EVENT_BEFORE: eventJson.before || '',
|
GITHUB_EVENT_BEFORE: eventJson.before || '',
|
||||||
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
|
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
|
||||||
|
GITHUB_EVENT_RELEASE_TARGET_COMMITISH:
|
||||||
|
eventJson.release?.target_commitish || '',
|
||||||
GITHUB_EVENT_HEAD_REPO_FORK: eventJson.head_repo?.fork || '',
|
GITHUB_EVENT_HEAD_REPO_FORK: eventJson.head_repo?.fork || '',
|
||||||
GITHUB_EVENT_PULL_REQUEST_NUMBER: eventJson.pull_request?.number || '',
|
GITHUB_EVENT_PULL_REQUEST_NUMBER: eventJson.pull_request?.number || '',
|
||||||
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: eventJson.pull_request?.base?.sha || '',
|
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: eventJson.pull_request?.base?.sha || '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user