Skip to content

Commit

Permalink
Merge pull request #11 from Akkjon/typescript
Browse files Browse the repository at this point in the history
Typescript
  • Loading branch information
Akkjon authored Jan 2, 2025
2 parents 88d3cb0 + e77f8b2 commit 2dd67f0
Show file tree
Hide file tree
Showing 3,097 changed files with 17,920 additions and 1,009,743 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
25 changes: 11 additions & 14 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.
**Describe the bug** A clear and concise description of what the bug is.

**To Reproduce** Steps to reproduce the behavior:

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.
**Expected behavior** A clear and concise description of what you expected to
happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.
**Screenshots** If applicable, add screenshots to help explain your problem.

**Pipeline (please complete the following information):**
- OS: [e.g. ubuntu]
- Version [e.g. v1]
- Inputs

**Additional context**
Add any other context about the problem here.
- OS: [e.g. ubuntu]
- Version [e.g. v1]
- Inputs

**Additional context** Add any other context about the problem here.
17 changes: 8 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Is your feature request related to a problem? Please describe.** A clear and
concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe the solution you'd like** A clear and concise description of what you
want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Describe alternatives you've considered** A clear and concise description of
any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
**Additional context** Add any other context or screenshots about the feature
request here.
65 changes: 65 additions & 0 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
env:
node: true
es6: true
jest: true

globals:
Atomics: readonly
SharedArrayBuffer: readonly

ignorePatterns:
- '!.*'
- '**/node_modules/.*'
- 'dist/*'
- '**/dist/.*'
- 'coverage/*'
- '**/coverage/.*'
- '*.json'
parser: '@typescript-eslint/parser'

parserOptions:
ecmaVersion: 2023
sourceType: module
project:
- './.github/linters/tsconfig.json'
- './tsconfig.json'

plugins:
- jest
- '@typescript-eslint'

extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended-type-checked
- plugin:jest/recommended

rules:
{
'camelcase': 'off',
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
'no-console': 'off',
'semi': 'off',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/explicit-member-accessibility':
['error', { 'accessibility': 'no-public' }],
'@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',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-function-type': 'warn',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/space-before-function-paren': 'off',
}
9 changes: 9 additions & 0 deletions .github/linters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{

Check warning on line 1 in .github/linters/tsconfig.json

View workflow job for this annotation

GitHub Actions / Lint Codebase

File ignored by default.
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["../../__tests__/**/*", "../../src/**/*"],
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
}
72 changes: 72 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript

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

permissions:
contents: read

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest

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: install
run: npm ci

- name: Build dist/ Directory
id: build
run: npm run bundle

# This will fail the workflow if the `dist/` directory is different than
# expected.
- name: Compare Directories
id: diff
run: |
if [ ! -d dist/ ]; then
echo "Expected dist/ directory does not exist. See status below:"
ls -la ./
exit 1
fi
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
# If `dist/` was different than expected, upload the expected version as a
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
130 changes: 130 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Continuous Integration

on:
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test-typescript:
name: TypeScript Tests
runs-on: ubuntu-latest

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: Check Format
id: npm-format-check
run: npm run format:check

- name: Lint
id: npm-lint
run: npm run lint

- name: Test
id: npm-test
run: npm run test

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

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

- name: Create Milestone
id: create-milestone
run: |
MILESTONE_NAME="Test-Milestone-$REF_NAME";
echo "🆕🏁 Creating Milestone with name $MILESTONE_NAME"
echo "MILESTONE_NAME=$MILESTONE_NAME" >> "$GITHUB_OUTPUT"
RESPONSE=$(curl -X POST -v \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.github+json" \
-d '{"title": "'"$MILESTONE_NAME"'", "state": "open", "description": "Test-Milestone", "due_on": "'"$(date -d '+1 days' '+%FT%TZ')"'"}' \
"https://api.github.com/repos/Akkjon/close-milestone-integration-test/milestones")
MILESTONE_ID=$(echo "$RESPONSE" | jq ".number")
echo "MILESTONE_ID=$MILESTONE_ID" >> "$GITHUB_OUTPUT"
echo "Created Milestone with number $MILESTONE_ID and name $MILESTONE_NAME"
env:
REF_NAME: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.INTEGRATION_TEST_ACCESS_TOKEN }}

- name: Test Local Action
id: test-action
uses: ./
env:
GITHUB_TOKEN: ${{ secrets.INTEGRATION_TEST_ACCESS_TOKEN }}
CLOSE_MILESTONE_REPOSITORY: 'Akkjon/close-milestone-integration-test'
with:
milestone_name: ${{ steps.create-milestone.outputs.MILESTONE_NAME }}
crash_on_missing: true

- name: Verify Action
id: verify
run: |
echo "🏁🔍 Retreiving all Milestones"
RESPONSE=$(curl \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/Akkjon/close-milestone-integration-test/milestones?state=all")
STATE=$(echo "$RESPONSE" | jq ".[] | select(.number==$ORIGINAL_MILESTONE_ID)" | jq -r ".state")
echo "🏁🧙‍♀️ Verifying that Milestone was correctly closed"
FAIL="FALSE"
if [[ "$CLOSED_MILESTONE_ID" != "$ORIGINAL_MILESTONE_ID" ]]; then
echo "Closed milestone id ($CLOSED_MILESTONE_ID) and opened milestone ($ORIGINAL_MILESTONE_ID) id do not match." >> /dev/stderr
FAIL="TRUE"
fi
if [[ "$STATE" != "closed" ]]; then
echo "Milestone did not get closed. Its state was $STATE" >> /dev/stderr
FAIL="TRUE"
fi
if [[ "$FAIL" == "TRUE" ]]; then
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.INTEGRATION_TEST_ACCESS_TOKEN }}
MILESTONE_NAME: ${{ steps.create-milestone.outputs.MILESTONE_NAME }}
ORIGINAL_MILESTONE_ID:
${{ steps.create-milestone.outputs.MILESTONE_ID }}
CLOSED_MILESTONE_ID: ${{ steps.test-action.outputs.milestone_id }}

- name: Cleanup Created Milestone
id: cleanup
if: always()
run: |
echo "🏁🚮 Deleting created Milestone"
curl -L \
-X DELETE \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/Akkjon/close-milestone-integration-test/milestones/$MILESTONE_ID"
env:
GITHUB_TOKEN: ${{ secrets.INTEGRATION_TEST_ACCESS_TOKEN }}
MILESTONE_ID: ${{ steps.create-milestone.outputs.MILESTONE_ID }}
48 changes: 48 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CodeQL

on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '31 7 * * 3'

permissions:
actions: read
checks: write
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language:
- TypeScript

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

- name: Initialize CodeQL
id: initialize
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src

- name: Autobuild
id: autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
id: analyze
uses: github/codeql-action/analyze@v3
Loading

0 comments on commit 2dd67f0

Please sign in to comment.