Skip to content

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 10, 2020
1 parent fa5aaef commit 947126c
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 112 deletions.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://help.github.com/ja/articles/metadata-syntax-for-github-actions
# https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions
name: GitHub Actions Template

description: Template for GitHub actions.
Expand All @@ -17,11 +17,14 @@ inputs:

branding:
# https://feathericons.com/
# e.g. https://haya14busa.github.io/github-action-brandings/
icon: 'package'
color: 'orange'

runs:
using: node12
main: lib/main.js
# pre: lib/pre.js
# pre-if: 'runner.os == linux'
# post: lib/post.js
# post-if: 'success()'
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"technote-space","repo":"gh-actions-template","sha":"8b239262a414fd1f156006aee8056dea30778f27","ref":"refs/tags/v0.7.5","tagName":"v0.7.5","branch":"gh-actions","tags":["v0.7.5","v0.7","v0"],"updated_at":"2020-12-07T16:21:48.569Z"}
{"owner":"technote-space","repo":"gh-actions-template","sha":"1511846c2d42c839201d91cbcb31c9a125af96a7","ref":"refs/tags/v0.7.6","tagName":"v0.7.6","branch":"gh-actions","tags":["v0.7.6","v0.7","v0"],"updated_at":"2020-12-10T15:02:33.308Z"}
16 changes: 3 additions & 13 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const core_1 = require("@actions/core");
Expand All @@ -17,17 +8,16 @@ const github_action_log_helper_1 = require("@technote-space/github-action-log-he
const filter_github_action_1 = require("@technote-space/filter-github-action");
const constant_1 = require("./constant");
const process_1 = require("./process");
const run = () => __awaiter(void 0, void 0, void 0, function* () {
(async () => {
const logger = new github_action_log_helper_1.Logger();
const context = new context_1.Context();
github_action_helper_1.ContextHelper.showActionInfo(path_1.resolve(__dirname, '..'), logger, context);
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, context)) {
logger.info('This is not target event.');
return;
}
yield process_1.execute(logger, github_action_helper_1.Utils.getOctokit(), context);
});
run().catch(error => {
await process_1.execute(logger, github_action_helper_1.Utils.getOctokit(), context);
})().catch(error => {
console.log(error);
core_1.setFailed(error.message);
});
17 changes: 4 additions & 13 deletions lib/process.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.execute = void 0;
const github_action_helper_1 = require("@technote-space/github-action-helper");
const issue_1 = require("./utils/issue");
const misc_1 = require("./utils/misc");
const execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
const execute = async (logger, octokit, context) => {
logger.startProcess('Dump context');
console.log(misc_1.getPayload(context));
logger.startProcess('Command test');
const command = new github_action_helper_1.Command(logger);
yield command.execAsync({
await command.execAsync({
command: 'ls -lat',
});
logger.startProcess('Color text');
Expand All @@ -28,8 +19,8 @@ const execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0,
logger.debug('debug...');
logger.log('log log log');
logger.startProcess('Get issues');
const issues = yield issue_1.getIssues(octokit, context);
const issues = await issue_1.getIssues(octokit, context);
console.log(issues.map(issue => issue.title));
logger.endProcess();
});
};
exports.execute = execute;
15 changes: 3 additions & 12 deletions lib/utils/issue.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIssues = void 0;
const getIssues = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
return (yield octokit.paginate(octokit.issues.listForRepo, Object.assign({}, context.repo))).map(item => item).filter(item => !('pull_request' in item));
});
const getIssues = async (octokit, context) => (await octokit.paginate(octokit.issues.listForRepo, {
...context.repo,
})).map(item => item).filter(item => !('pull_request' in item));
exports.getIssues = getIssues;
Loading

0 comments on commit 947126c

Please sign in to comment.