-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jan-guenter/feature/workflow-improvements
Workflows and README improvements
- Loading branch information
Showing
9 changed files
with
204 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Code Scan | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths-ignore: | ||
- '**.md' | ||
schedule: | ||
- cron: '42 13 * * 6' | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: javascript | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Determine pnpm store location | ||
id: pnpm-store | ||
run: echo "pnpm-store=$(pnpm store path)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pnpm-store.outputs.pnpm-store }} | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
- name: pnpm install | ||
run: pnpm install -r | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: /language:javascript | ||
|
||
- name: Install ESLint | ||
run: pnpm install -w @microsoft/eslint-formatter-sarif | ||
|
||
- name: Run ESLint | ||
run: pnpm eslint | ||
--format @microsoft/eslint-formatter-sarif | ||
--output-file eslint-results.sarif | ||
|| true | ||
continue-on-error: true | ||
|
||
- name: Upload eslint results to GitHub | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: eslint-results.sarif | ||
|
||
- name: Run njsscan scan | ||
uses: ajinabraham/njsscan-action@v7 | ||
with: | ||
args: packages/*/lib/*.js | ||
--sarif | ||
--output njsscan-results.sarif | ||
continue-on-error: true | ||
|
||
- name: Upload njsscan report to GitHub | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: njsscan-results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Coverage Report | ||
on: | ||
workflow_run: | ||
workflows: [Build and Test] | ||
types: | ||
- completed | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
checks: write | ||
statuses: write | ||
|
||
jobs: | ||
report: | ||
strategy: | ||
matrix: | ||
runs-on: [ubuntu-latest, macos-latest, windows-latest] | ||
fail-fast: false | ||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- name: Download Coverage Report | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "coverage-${{ matrix.runs-on }}" | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage.zip`, Buffer.from(download.data)); | ||
- name: Unzip artifact | ||
run: unzip coverage.zip | ||
|
||
- name: Check Coverage Report | ||
uses: slavcodev/coverage-monitor-action@v1 | ||
with: | ||
github_token: ${{ github.token }} | ||
status_context: Coverage Report - ${{ matrix.runs-on }} | ||
comment_context: Coverage Report - ${{ matrix.runs-on }} | ||
comment_footer: false | ||
coverage_path: clover.xml | ||
threshold_alert: 70 | ||
threshold_warning: 80 | ||
threshold_metric: statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,48 @@ | ||
# GitHub Action class framework | ||
|
||
- [`@action-class/core`](packages/core) is a framework for creating GitHub Actions in TypeScript. | ||
- [`@action-class/action-yml`](packages/action-yml) is a type library for reading and writing `action.yml` files. | ||
[![Build and Test](https://img.shields.io/github/actions/workflow/status/jan-guenter/action-class/build-and-test.yml?branch=main&label=Build%20and%20Test&logo=github)](https://github.com/jan-guenter/action-class/actions/workflows/build-and-test.yml) | ||
[![Test Report](https://img.shields.io/github/actions/workflow/status/jan-guenter/action-class/test-report.yml?branch=main&label=Test%20Report&logo=github)](https://github.com/jan-guenter/action-class/actions/workflows/test-report.yml) | ||
[![Coverage Report](https://img.shields.io/github/actions/workflow/status/jan-guenter/action-class/coverage-report.yml?branch=main&label=Coverage%20Report&logo=github)](https://github.com/jan-guenter/action-class/actions/workflows/coverage-report.yml) | ||
[![MegaLinter](https://img.shields.io/github/actions/workflow/status/jan-guenter/action-class/mega-linter.yml?branch=main&label=MegaLinter&logo=github)](https://github.com/jan-guenter/action-class/actions/workflows/mega-linter.yml) | ||
|
||
[![GitHub last commit](https://img.shields.io/github/last-commit/jan-guenter/action-class?logo=github)](https://github.com/jan-guenter/action-class/graphs/commit-activity) | ||
[![GitHub issues](https://img.shields.io/github/issues/jan-guenter/action-class?logo=github)](https://github.com/jan-guenter/action-class/issues) | ||
[![GitHub pull requests](https://img.shields.io/github/issues-pr/jan-guenter/action-class?logo=github)](https://github.com/jan-guenter/action-class/pulls) | ||
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/jan-guenter/action-class?logo=github)](https://github.com/jan-guenter/action-class/graphs/commit-activity) | ||
[![GitHub contributors](https://img.shields.io/github/contributors/jan-guenter/action-class?logo=github)](https://github.com/jan-guenter/action-class/graphs/contributors) | ||
|
||
## Packages | ||
|
||
--- | ||
|
||
### [`@action-class/core`](packages/core) | ||
|
||
A framework for creating GitHub Actions in TypeScript. | ||
|
||
[![npm](https://img.shields.io/npm/v/@action-class/core?logo=npm)](https://www.npmjs.com/package/@action-class/core) | ||
[![Downloads](https://img.shields.io/npm/dt/@action-class/core?logo=npm)](https://www.npmjs.com/package/@action-class/core) | ||
[![License](https://img.shields.io/npm/l/@action-class/core)](packages/core/LICENSE) | ||
|
||
<!-- markdown-link-check-disable-next-line --> | ||
[![Dependencies](https://img.shields.io/librariesio/release/npm/@action-class/core?logo=npm)](https://libraries.io/npm/@action-class%2Fcore/tree) | ||
![Dependents](https://img.shields.io/librariesio/dependents/npm/@action-class/core?logo=npm) | ||
[![SourceRank](https://img.shields.io/librariesio/sourcerank/npm/@action-class/core)](https://libraries.io/npm/@action-class%2Fcore/sourcerank) | ||
|
||
A detailed description can be found in the package [README](packages/core/README.md) | ||
|
||
--- | ||
|
||
### [`@action-class/action-yml`](packages/action-yml) | ||
|
||
A type library for reading and writing `action.yml` files. | ||
|
||
[![NPM](https://img.shields.io/npm/v/@action-class/action-yml?logo=npm)](https://www.npmjs.com/package/@action-class/action-yml) | ||
[![Downloads](https://img.shields.io/npm/dt/@action-class/action-yml?logo=npm)](https://www.npmjs.com/package/@action-class/action-yml) | ||
[![License](https://img.shields.io/npm/l/@action-class/action-yml)](packages/core/LICENSE) | ||
|
||
<!-- markdown-link-check-disable-next-line --> | ||
[![Dependencies](https://img.shields.io/librariesio/release/npm/@action-class/action-yml?logo=npm)](https://libraries.io/npm/@action-class%2Faction-yml/tree) | ||
![Dependents](https://img.shields.io/librariesio/dependents/npm/@action-class/action-yml?logo=npm) | ||
[![SourceRank](https://img.shields.io/librariesio/sourcerank/npm/@action-class/action-yml?logo=npm)](https://libraries.io/npm/@action-class%2Faction-yml/sourcerank) | ||
|
||
A detailed description can be found in the package [README](packages/action-yml/README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters