Skip to content

Commit

Permalink
Changes in Compliance controls structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Ahlskog committed Sep 14, 2023
1 parent 25c0c3b commit a835a58
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 134 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": ["node_modules", "test"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/typedef": [
"error",
{
"arrayDestructuring": true,
"arrowCallSignature": true,
"arrowParameter": true,
"callSignature": true,
"memberVariableDeclaration": true,
"parameter": true,
"propertyDeclaration": true,
"objectDestructuring": true,
"variableDeclaration": true,
"variableDeclarationIgnoreFunction": true
}
],
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/naming-convention": ["error", { "selector": "variableLike", "format": ["camelCase"] }]
}
}
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

39 changes: 7 additions & 32 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
name: Build
run-name: ${{ github.actor }} is testing out github actions
# permissions:
# actions: read
# checks: read
# contents: read
# deployments: read
# id-token: write
# issues: read
# discussions: read
# packages: read
# pages: read
# pull-requests: read
# repository-projects: read
# security-events: read
# statuses: read
permissions:
contents: write
pages: write
id-token: write

on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run a one-line script
run: echo Hello, world!
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your projectss
- name: Setup node
uses: actions/setup-node@v3
- name: Install
run: npm ci
- name: Build
run: npm run package
# - name: 'Az CLI login'
# uses: azure/login@v1
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# - name: 'Run Azure CLI commands'
# run: az account show
- name: 'Custom Task running'
run: npm run build
- name: 'Run Compliance State'
uses: ./
with:
repo-token: ${{ secrets.MY_GITHUB_PAT}}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ __tests__/runner/*
.idea
.vscode
*.code-workspace

dist
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
coverage/
coverage/
README.md
4 changes: 0 additions & 4 deletions CODEOWNERS

This file was deleted.

22 changes: 0 additions & 22 deletions LICENSE

This file was deleted.

26 changes: 26 additions & 0 deletions LinitingAndFormat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to install linting and format

1. Run the following commands (be in the root, if you don't have a package.json there, run npm init first to create one):

```yaml
npm install eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin husky prettier --save-dev
npm pkg set scripts.prepare="husky install"
npm run prepare
```

2. Copy files: .eslintrc.json, .prettierignore, .prettierrc and .husky/pre-commit

3. Add following to script section in package.json:

```json
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix --ext .ts",
"format:write": "npx prettier -w .",
"format:check": "npx prettier -c .",
```

4. Make a commit. You should see that your files are being checked for rule breaks. If it does not work and you are using a Mac, run following command and try a new commit:

```yaml
chmod ug+x .husky/*
```
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# CyDig Pipeline Tasks
# CyDig Compliance Action

This repository contains compliance tasks.
This repository contains a action with compliance controls.
7 changes: 0 additions & 7 deletions __tests__/index.test.ts

This file was deleted.

8 changes: 1 addition & 7 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: 'cydig/compliance@v1'
description: 'Provide a description here'
description: 'Cydig compliance action'
author: 'Jonathan'

# Define your inputs here.
# inputs:
# subscription:
# description: 'SubscriptionId to use for the connections in the custom task.'
# required: true
# default: 'Not working'
inputs:
repo-token:
description: 'SubscriptionId to use for the connections in the custom task.'
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 8 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
{
"name": "typescript-action",
"description": "GitHub Actions TypeScript template",
"version": "0.0.0",
"name": "cydig-compliance-action",
"description": "cydig-compliance-action",
"version": "1.0.0",
"author": "",
"private": true,
"homepage": "https://github.com/actions/typescript-action",
"repository": {
"type": "git",
"url": "git+https://github.com/actions/typescript-action.git"
},
"bugs": {
"url": "https://github.com/actions/typescript-action/issues"
},
"keywords": [
"actions",
"node",
"setup"
],
"keywords": [],
"exports": {
".": "./dist/index.js"
},
"engines": {
"node": ">=16"
},
"scripts": {
"bundle": "npm run format:write && npm run package",
"bundle": "npm run format:write && npm run build",
"format:write": "prettier --write '**/*.ts'",
"format:check": "prettier --check '**/*.ts'",
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
"package": "ncc build src/index.ts --license licenses.txt",
"package:watch": "npm run package -- --watch",
"build": "ncc build src/index.ts --license licenses.txt",
"build:watch": "npm run build -- --watch",
"test": "",
"all": "npm run format:write && npm run lint && npm run test && npm run package"
"all": "npm run format:write && npm run lint && npm run test && npm run build"
},
"license": "MIT",
"dependencies": {
Expand Down
Empty file.
34 changes: 1 addition & 33 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,8 @@
"noImplicitAny": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
// "strict": true,
"skipLibCheck": true,
"newLine": "lf"
},
"exclude": ["./dist", "./node_modules", "./__tests__", "./coverage"]
}
// {
// "compilerOptions": {
// "target": "ES2021",
// "module": "commonjs",
// "outDir": "js_out",
// "sourceMap": true,
// "esModuleInterop": true,
// "skipLibCheck": true
// //"strict": true
// },
// "include": ["**/*"],
// "exclude": ["node_modules", "**/*.js"]
// }

//Prettier : .prettierrc.json
// {
// "printWidth": 80,
// "tabWidth": 2,
// "useTabs": false,
// "semi": false,
// "singleQuote": true,
// "quoteProps": "as-needed",
// "jsxSingleQuote": false,
// "trailingComma": "none",
// "bracketSpacing": true,
// "bracketSameLine": true,
// "arrowParens": "avoid",
// "proseWrap": "always",
// "htmlWhitespaceSensitivity": "css",
// "endOfLine": "lf"
// }
}

0 comments on commit a835a58

Please sign in to comment.