Skip to content

Commit

Permalink
Initial commit (#2)
Browse files Browse the repository at this point in the history
Added initial code
  • Loading branch information
James A. Prempeh committed Jun 23, 2020
1 parent b8770de commit 9633b9b
Show file tree
Hide file tree
Showing 7 changed files with 855 additions and 101 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# name: Default

# on:
# push:
# # branches: [ dev ]
# pull_request:
# # branches: [ dev ]

# jobs:
# checks:
# runs-on: ubuntu-latest

# strategy:
# matrix:
# node-version: [12.x]

# steps:
# - name: Checkout Repository
# uses: actions/checkout@v2
# with:
# persist-credentials: false

# - name: Setup Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}

# - name: Install
# run: npm ci --no-audit --prefer-offline

# - name: Run Checks Locally
# run: npm run lint
# continue-on-error: true

# - name: Annotate Checks
# uses: ./.github/actions/my-action
# with:
# ghToken: ${{ secrets.GITHUB_TOKEN }}
# eslintFiles: "node-app"
# eslintConfig: ".eslintrc.js"
# eslintExt: "ts, tsx"

# - name: Lint Code Base
# uses: docker://github/super-linter:v2.1.1
# env:
# VALIDATE_ALL_CODEBASE: false
# ACTIONS_RUNNER_DEBUG: true
# VALIDATE_ANSIBLE: false

# # - name: Annotate Lint
# # uses: ataylorme/eslint-annotate-action@1.0.4
# # with:
# # repo-token: "${{ secrets.GITHUB_TOKEN }}"
# # report-json: "eslint_report.json"
# # - name: Upload ESLint report
# # uses: actions/upload-artifact@v1
# # with:
# # name: eslint_report.json
# # path: eslint_report.json

# - name: Build
# run: npm run build:js --if-present

# # - name: Test
# # run: npm run test


# # - uses: mdecoleman/pr-branch-name@1.0.0
# # id: vars
# # with:
# # repo-token: ${{ secrets.GITHUB_TOKEN }}

# # - name: Echo Branches
# # run: |
# # echo "Current Branch: ${{ steps.vars.outputs.branch }}"
# # echo "PR Head Branch: ${{github.head_ref}}"
# # echo "PR Base Branch: ${{github.base_ref}}"
# # echo "PR Number: ${{ github.event.number }}""



101 changes: 1 addition & 100 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,5 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
dist/
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# ci-checks-action
# Customizable CI Checks With Annotations

## Description

Create Github checks (with annotations) from custom ci scripts output (JSON) files. The annotations include a summary of errors and warnings, including links to the line numbers of the violations. Work on both pull requests (only on changed files) and pushes.


## Rationale

This actions allows for more flexibility in implementing ci checks. Instead on bundling the actual ci checks, it allows you to use any ci script, as long as it output its results to a local JSON file in the proper format.

## Usage Example

In `.github/workflows/nodejs.yml`:

```yml
name: Example Workflow

on: [pull_request]

jobs:
checks:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Setup Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install Dependencies
run: npm ci

- name: Run Checks
run: npm run lint
run: npm run test
run: npm run benchmark
# Continue to the next step even if this fails
continue-on-error: true

- name: Annotate Checks
uses: prmph/ci-checks-action@1.0.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# Paths for JSON file for each check, separate by semicolons (e.g. "lint:eslint.json; test:test_report.json")
checks: "lint:eslint_report.json; test:mocha_test_report.json"
```
17 changes: 17 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Customizable CI Checks With Annotations"
# description: "Run CI checks with custom scripts reporting to a JSON file and annotate them on Gthub."
# description: "Report results of your ci check scripts as Github checks (with file annotations)"
description: "Create Github checks (with file annotations) from JSON file outputs of custom ci scripts"
inputs:
repo-token:
description: "Token used to authenticate with the Github API."
required: true
checks:
description: "Paths for JSON file for each check, separated by semi-colons"
required: true
runs:
using: "node12"
main: "dist/index.js"
branding:
icon: "check-circle"
color: "green"
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "ci-checks-action",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/eslint": "^7.2.0",
"@types/node": "^14.0.13",
"@types/shelljs": "^0.8.8",
"eslint": "^7.3.0",
"typescript": "^3.9.5"
},
"dependencies": {
"@actions/core": "^1.2.4",
"@actions/github": "^3.0.0",
"shelljs": "^0.8.4"
}
}
Loading

0 comments on commit 9633b9b

Please sign in to comment.