Skip to content

Commit 7b6b40c

Browse files
committed
Merge branch 'master' into add-any-fields
2 parents dfc8580 + cd4b4a1 commit 7b6b40c

File tree

19 files changed

+8756
-26566
lines changed

19 files changed

+8756
-26566
lines changed

.github/workflows/approve.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Auto LGTM Image Submitter
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted]
6+
7+
jobs:
8+
build:
9+
if: ${{ github.event.review.state == 'approved' }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- uses: lazy-actions/lgtm-image-action@main
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "**.ts"
9+
- "package.json"
10+
- "yarn.lock"
11+
- "tsconfig.json"
12+
13+
jobs:
14+
build:
15+
name: Transpile Typescript
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: '14'
23+
24+
- name: Setup workspace
25+
run: yarn install --frozen-lockfile
26+
27+
- name: Transpile
28+
run: yarn run build
29+
30+
- name: Push changes
31+
run: |
32+
git config user.name "${GITHUB_ACTOR}"
33+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
34+
git add .
35+
git commit -m "build: Transpile" || echo "No changes to commit"
36+
git push origin HEAD

.github/workflows/lint.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tests
2+
3+
on: pull_request
4+
5+
jobs:
6+
test:
7+
name: Test
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: '14'
15+
16+
- name: Setup workspace
17+
run: yarn install --frozen-lockfile
18+
19+
- name: Format check
20+
run: yarn run format:check
21+
22+
- name: Run test
23+
run: yarn run test

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
.config/
33
.npm/
44
node_modules/
5-
yarn-error.log
5+
yarn-error.log
6+
.node-version
7+
.vscode/

.prettierrc.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"printWidth": 80,
3-
"tabWidth": 2,
4-
"useTabs": false,
5-
"semi": true,
6-
"singleQuote": true,
7-
"trailingComma": "none",
8-
"bracketSpacing": false,
9-
"arrowParens": "avoid",
10-
"parser": "typescript"
11-
}
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Slatify
22

3-
![GitHub Workflow](https://github.com/lazy-actions/slatify/workflows/lint/badge.svg)
3+
![Build](https://img.shields.io/github/workflow/status/lazy-actions/slatify/Build?label=build)
4+
![Test](https://img.shields.io/github/workflow/status/lazy-actions/slatify/Tests?label=test)
45
![GitHub release (latest by date)](https://img.shields.io/github/v/release/lazy-actions/slatify?color=brightgreen)
56
![GitHub](https://img.shields.io/github/license/lazy-actions/slatify?color=brightgreen)
67
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

__tests__/github.test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import * as github from '@actions/github';
2+
import {getWorkflowUrls} from '../src/github';
3+
4+
export const commonContext = {
5+
workflow: 'test',
6+
ref: '1',
7+
sha: '2',
8+
owner: 'lazy-actions',
9+
repo: 'slatify',
10+
number: 3
11+
};
12+
export const repoUrl = `https://github.com/${commonContext.owner}/${commonContext.repo}`;
13+
14+
github.context.workflow = commonContext.workflow;
15+
github.context.ref = commonContext.ref;
16+
github.context.sha = commonContext.sha;
17+
github.context.payload = {
18+
issue: {
19+
number: commonContext.number
20+
},
21+
repository: {
22+
owner: {
23+
login: commonContext.owner
24+
},
25+
name: commonContext.repo
26+
}
27+
};
28+
29+
describe('Workflow URL Tests', () => {
30+
test('Pull Request event', () => {
31+
github.context.eventName = 'pull_request';
32+
const expectedEventUrl = `${repoUrl}/pull/${commonContext.number}`;
33+
const expectedUrls = {
34+
repo: repoUrl,
35+
event: expectedEventUrl,
36+
action: `${expectedEventUrl}/checks`
37+
};
38+
expect(getWorkflowUrls()).toEqual(expectedUrls);
39+
});
40+
41+
test('Push event', () => {
42+
github.context.eventName = 'commit';
43+
const expectedUrls = {
44+
repo: repoUrl,
45+
action: `${repoUrl}/commit/${commonContext.sha}/checks`
46+
};
47+
expect(getWorkflowUrls()).toEqual(expectedUrls);
48+
});
49+
});

__tests__/main.test.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

__tests__/payload.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"text": "This is test",
3+
"attachments": [
4+
{
5+
"color": "danger",
6+
"blocks": [
7+
{
8+
"type": "section",
9+
"fields": [
10+
{
11+
"type": "mrkdwn",
12+
"text": "Hello World"
13+
},
14+
{
15+
"type": "mrkdwn",
16+
"text": "YEAH!!!!!"
17+
}
18+
]
19+
}
20+
]
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)