Skip to content
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

bundle with pkgroll & convert to module #1

Merged
merged 18 commits into from
Nov 11, 2024
11 changes: 3 additions & 8 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default [
"lib",
"**/*.json",
"eslint.config.mjs",
"vitest.config.mjs",
"vitest.config.ts",
"dist/**/*.ts",
"dist/**",
"**/*.mjs",
Expand Down Expand Up @@ -75,13 +75,6 @@ export default [
},
],

"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],

"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-inferrable-types": "error",
Expand All @@ -96,6 +89,8 @@ export default [
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
Expand Down
5 changes: 1 addition & 4 deletions .github/linters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
}
"extends": "../../tsconfig.json"
}
68 changes: 64 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,81 @@ jobs:
id: npm-ci-test
run: npm run ci-test

test-action:
name: GitHub Actions Test
test-action-pr:
name: Test action - PR
runs-on: ubuntu-latest

permissions:
id-token: write
contents: read
pull-requests: write # we need this to write comments in PRs

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

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

- name: Install Dependencies
id: npm-ci
run: npm ci

- name: Test Local Action
id: test-action
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ github.event.number }}

- name: Print Output
id: output
run: |
echo "${{ steps.test-action.outputs.total_orphan_files }}"
echo "${{ steps.test-action.outputs.total_scanned_files }}"
echo "${{ steps.test-action.outputs.failed }}"

test-action-branch:
name: Test action - Branch
runs-on: ubuntu-latest

permissions:
id-token: write
contents: read
pull-requests: write # we need this to write comments in PRs

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

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

- name: Install Dependencies
id: npm-ci
run: npm ci

- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 2000
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "main" # use ${{ github.ref_name }} when using this on a real branch
fail-on-missing-codeowners: false

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
run: |
echo "${{ steps.test-action.outputs.total_orphan_files }}"
echo "${{ steps.test-action.outputs.total_scanned_files }}"
echo "${{ steps.test-action.outputs.failed }}"
48 changes: 0 additions & 48 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

18 changes: 15 additions & 3 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Repository CODEOWNERS

* @getyourguide/tp
.devcontainers @getyourguide/tp
.github @getyourguide/tp
.vscode @getyourguide/tp
dist @getyourguide/tp
script @getyourguide/tp
src @getyourguide/tp
.env.example @getyourguide/tp
.gitignore @getyourguide/tp
.prettier* @getyourguide/tp
action.yml @getyourguide/tp
LICENSE @getyourguide/tp
package* @getyourguide/tp
README.md @getyourguide/tp
tsconfig.json @getyourguide/tp
vitest.config.ts @getyourguide/tp
51 changes: 39 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,44 @@ inputs:
codeartifact-auth-token:
description: "Token for the registry"
required: true
# outputs:
# total_orphan_files:
# description: "Total number of orphaned files"
# value: ${{ steps.codeowners.outputs.total_orphan_files }}
# total_scanned_files:
# description: "Total files"
# value: ${{ steps.codeowners.outputs.total_scanned_files }}
# failed:
# description: "If the action failed"
# value: ${{ steps.codeowners.outputs.failed }}

outputs:
total_orphan_files:
description: "Total number of orphaned files"
value: ${{ steps.codeowners.outputs.total_orphan_files }}
total_scanned_files:
description: "Total files"
value: ${{ steps.codeowners.outputs.total_scanned_files }}
failed:
description: "If the action failed"
value: ${{ steps.codeowners.outputs.failed }}

runs:
using: node20
main: dist/index.js
using: "composite"
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

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

- name: Install Dependencies
shell: bash
id: npm-ci
run: npm ci

- name: Check Codeowners
shell: bash
run: node ./dist/index.js
env:
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_CODEOWNERS_PATH: ${{ inputs.codeowners_path }}
INPUT_PR_NUMBER: ${{ inputs.pr-number }}
INPUT_FAIL_ON_MISSING_CODEOWNERS:
${{ inputs.fail-on-missing-codeowners }}
INPUT_BRANCH: ${{ inputs.branch }}
Loading