Skip to content

Add support to get all runs regardless the workflow file exists #176

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
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
18 changes: 0 additions & 18 deletions .eslintrc

This file was deleted.

119 changes: 119 additions & 0 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Test and Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

test:
name: Test (Node ${{ matrix.node-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20.x, 22.x]
exclude:
# Exclude some combinations to save CI time
- os: windows-latest
node-version: 22.x
- os: macos-latest
node-version: 22.x

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: false
verbose: true

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Verify build succeeded
run: |
if [ ! -f "dist/index.js" ]; then
echo "::error::Build failed - dist/index.js not found"
exit 1
fi
echo "Build completed successfully"

# This job is used as a required check in branch protection rules
ci-status:
name: CI Status
runs-on: ubuntu-latest
needs: [lint, test, build]
if: always()

steps:
- name: Check CI status
run: |
if [[ "${{ needs.lint.result }}" == "failure" || "${{ needs.test.result }}" == "failure" || "${{ needs.build.result }}" == "failure" ]]; then
echo "::error::One or more CI jobs failed"
exit 1
fi
echo "All CI checks passed successfully"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Clean Workflow Action

[![Test and Lint](https://github.com/igorjs/gh-actions-clean-workflow/actions/workflows/test-and-lint.yml/badge.svg)](https://github.com/igorjs/gh-actions-clean-workflow/actions/workflows/test-and-lint.yml)

Clean workflow run logs based on configuration.

## Usage
Expand Down
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

70 changes: 66 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,78 @@
const js = require("@eslint/js");
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const globals = require("globals");

// Available global sets from the globals package:
// - globals.browser - Browser environment globals
// - globals.node - Node.js globals (includes CommonJS)
// - globals.nodeBuiltin - Node.js built-ins only (no CommonJS)
// - globals.es2015 to globals.es2025 - ECMAScript globals by year
// - globals.jest, globals.mocha, globals.jasmine, globals.vitest - Testing frameworks
// - globals.commonjs - CommonJS specific (require, module, exports)
// - globals.worker - Web Worker environment
// - globals.serviceworker - Service Worker environment
// - globals.jquery - jQuery globals
// - globals['shared-node-browser'] - Shared between Node.js and browsers

module.exports = [
// Base JavaScript configuration
js.configs.recommended,

// JavaScript files configuration
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
console: "readonly",
process: "readonly",
...globals.node,
...globals.es2021,
},
},
},

// TypeScript configuration
{
ignores: [".github/**", "dist/**", "node_modules/**"],
files: ["**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
project: "./tsconfig.json",
},
globals: {
...globals.node,
...globals.es2021,
...globals.jest,
},
},
plugins: {
"@typescript-eslint": tsPlugin,
},
rules: {
...tsPlugin.configs.recommended.rules,
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"no-unused-vars": "off", // Turn off base rule as it's handled by TypeScript
},
},

// Ignore patterns
{
ignores: [
".github/**",
"dist/**",
"node_modules/**",
"coverage/**",
"*.config.js",
"*.config.ts",
"**/*.test.ts",
"**/*.spec.ts",
],
},
js.configs.recommended,
];
26 changes: 26 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>/src"],
testMatch: ["**/*.test.ts"],
collectCoverageFrom: [
"src/**/*.ts",
"!src/**/*.d.ts",
"!src/**/__tests__/**",
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
clearMocks: true,
restoreMocks: true,
maxWorkers: 1, // Run tests sequentially
};

export default config;
Loading