Skip to content

Commit

Permalink
Merge branch 'master' into add-any-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
whywaita committed May 16, 2021
2 parents dfc8580 + cd4b4a1 commit d9a4df4
Show file tree
Hide file tree
Showing 19 changed files with 8,757 additions and 26,566 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Auto LGTM Image Submitter

on:
pull_request_review:
types: [submitted]

jobs:
build:
if: ${{ github.event.review.state == 'approved' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: lazy-actions/lgtm-image-action@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
push:
branches:
- master
paths:
- "**.ts"
- "package.json"
- "yarn.lock"
- "tsconfig.json"

jobs:
build:
name: Transpile Typescript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '14'

- name: Setup workspace
run: yarn install --frozen-lockfile

- name: Transpile
run: yarn run build

- name: Push changes
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "build: Transpile" || echo "No changes to commit"
git push origin HEAD
44 changes: 0 additions & 44 deletions .github/workflows/lint.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on: pull_request

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '14'

- name: Setup workspace
run: yarn install --frozen-lockfile

- name: Format check
run: yarn run format:check

- name: Run test
run: yarn run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.config/
.npm/
node_modules/
yarn-error.log
yarn-error.log
.node-version
.vscode/
20 changes: 10 additions & 10 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Slatify

![GitHub Workflow](https://github.com/lazy-actions/slatify/workflows/lint/badge.svg)
![Build](https://img.shields.io/github/workflow/status/lazy-actions/slatify/Build?label=build)
![Test](https://img.shields.io/github/workflow/status/lazy-actions/slatify/Tests?label=test)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/lazy-actions/slatify?color=brightgreen)
![GitHub](https://img.shields.io/github/license/lazy-actions/slatify?color=brightgreen)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
Expand Down
49 changes: 49 additions & 0 deletions __tests__/github.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as github from '@actions/github';
import {getWorkflowUrls} from '../src/github';

export const commonContext = {
workflow: 'test',
ref: '1',
sha: '2',
owner: 'lazy-actions',
repo: 'slatify',
number: 3
};
export const repoUrl = `https://github.com/${commonContext.owner}/${commonContext.repo}`;

github.context.workflow = commonContext.workflow;
github.context.ref = commonContext.ref;
github.context.sha = commonContext.sha;
github.context.payload = {
issue: {
number: commonContext.number
},
repository: {
owner: {
login: commonContext.owner
},
name: commonContext.repo
}
};

describe('Workflow URL Tests', () => {
test('Pull Request event', () => {
github.context.eventName = 'pull_request';
const expectedEventUrl = `${repoUrl}/pull/${commonContext.number}`;
const expectedUrls = {
repo: repoUrl,
event: expectedEventUrl,
action: `${expectedEventUrl}/checks`
};
expect(getWorkflowUrls()).toEqual(expectedUrls);
});

test('Push event', () => {
github.context.eventName = 'commit';
const expectedUrls = {
repo: repoUrl,
action: `${repoUrl}/commit/${commonContext.sha}/checks`
};
expect(getWorkflowUrls()).toEqual(expectedUrls);
});
});
3 changes: 0 additions & 3 deletions __tests__/main.test.ts

This file was deleted.

23 changes: 23 additions & 0 deletions __tests__/payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"text": "This is test",
"attachments": [
{
"color": "danger",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "Hello World"
},
{
"type": "mrkdwn",
"text": "YEAH!!!!!"
}
]
}
]
}
]
}
Loading

0 comments on commit d9a4df4

Please sign in to comment.