Skip to content

Release/v1.2.3 #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 23, 2019
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['8', '10', '11', '12']
node: ['10', '11', '12']
steps:
- uses: actions/checkout@v1
with:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
schedule:
- cron: 0 17 * * *
pull_request:
types: [opened, synchronize, reopened, closed]

name: Update dependencies
jobs:
release:
name: Update npm dependencies
runs-on: ubuntu-latest
steps:
- name: Update dependencies
uses: technote-space/create-pr-action@v1
with:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GLOBAL_INSTALL_PACKAGES: npm-check-updates
EXECUTE_COMMANDS: |
ncu -u --packageFile package.json
yarn install
yarn upgrade
yarn audit
COMMIT_MESSAGE: 'chore: update npm dependencies'
COMMIT_NAME: Technote
COMMIT_EMAIL: technote.space@gmail.com
PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'
PR_TITLE: 'chore: update npm dependencies'
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@technote-space/assign-author",
"version": "1.2.2",
"version": "1.2.3",
"description": "GitHub actions to assign author to issue or PR.",
"author": "Technote <technote.space@gmail.com> (https://technote.space)",
"license": "MIT",
Expand All @@ -21,21 +21,21 @@
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/github": "^1.1.0",
"@technote-space/filter-github-action": "^0.1.5",
"@technote-space/github-action-helper": "^0.2.1"
"@technote-space/filter-github-action": "^0.1.10",
"@technote-space/github-action-helper": "^0.6.0"
},
"devDependencies": {
"@technote-space/github-action-test-helper": "^0.0.12",
"@types/jest": "^24.0.19",
"@types/node": "^12.11.7",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"eslint": "^6.5.1",
"@technote-space/github-action-test-helper": "^0.0.22",
"@types/jest": "^24.0.23",
"@types/node": "^12.12.12",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"eslint": "^6.7.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"nock": "^11.6.0",
"ts-jest": "^24.1.0",
"typescript": "^3.6.4"
"nock": "^11.7.0",
"ts-jest": "^24.2.0",
"typescript": "^3.7.2"
},
"publishConfig": {
"access": "public"
Expand Down
24 changes: 9 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@ import path from 'path';
import { setFailed, getInput } from '@actions/core';
import { context, GitHub } from '@actions/github';
import { isTargetEvent } from '@technote-space/filter-github-action';
import { Logger, Utils } from '@technote-space/github-action-helper';
import { Logger, ContextHelper } from '@technote-space/github-action-helper';
import { getAssignees } from './utils/context';
import { addAssignees } from './utils/github';
import { TARGET_EVENTS } from './constant';

const {showActionInfo} = Utils;

/**
* run
*/
async function run(): Promise<void> {
try {
const logger = new Logger();
showActionInfo(path.resolve(__dirname, '..'), logger, context);

if (!isTargetEvent(TARGET_EVENTS, context)) {
logger.info('This is not target event.');
return;
}
const logger = new Logger();
ContextHelper.showActionInfo(path.resolve(__dirname, '..'), logger, context);

await addAssignees(getAssignees(context), new GitHub(getInput('GITHUB_TOKEN', {required: true})), logger, context);
} catch (error) {
setFailed(error.message);
if (!isTargetEvent(TARGET_EVENTS, context)) {
logger.info('This is not target event.');
return;
}

await addAssignees(getAssignees(context), new GitHub(getInput('GITHUB_TOKEN', {required: true})), logger, context);
}

run();
run().catch(error => setFailed(error.message));
4 changes: 2 additions & 2 deletions src/utils/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from '@actions/github/lib/context';
import { Utils } from '@technote-space/github-action-helper';
import { ContextHelper } from '@technote-space/github-action-helper';

const getCurrentAssignees = (context: Context): string[] | false => {
if ('issues' === context.eventName) {
Expand All @@ -12,7 +12,7 @@ const getCurrentAssignees = (context: Context): string[] | false => {
};

export const getAssignees = (context: Context): string[] | false => {
const sender = Utils.getSender(context);
const sender = ContextHelper.getSender(context);
if (false === sender) {
return false;
}
Expand Down
Loading