diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..efe5f4b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check: + strategy: + fail-fast: true + matrix: + script: [format] + + name: Code check + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js (via .nvmrc) + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "pnpm" + + - name: Install Dependencies + shell: bash + run: pnpm install --frozen-lockfile + + - name: Run ${{ matrix.script }} + run: pnpm run ${{ matrix.script }} + + ci-ok: + name: CI OK + runs-on: ubuntu-latest + if: always() + needs: [check] + env: + FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }} + CANCELLED: ${{ contains(join(needs.*.result, ','), 'cancelled') }} + steps: + - name: Check for failure or cancelled jobs result + shell: bash + run: | + echo "Failure: $FAILURE - Cancelled: $CANCELLED" + if [ "$FAILURE" = "false" ] && [ "$CANCELLED" = "false" ]; then + exit 0 + else + exit 1 + fi diff --git a/.github/workflows/spell-checking.yml b/.github/workflows/spell-checking.yml new file mode 100644 index 0000000..3bac08e --- /dev/null +++ b/.github/workflows/spell-checking.yml @@ -0,0 +1,66 @@ +name: Spell Checker + +on: + push: + branches: + - main + + pull_request: + +jobs: + spell_checking: + name: LanguageTool + runs-on: ubuntu-latest + + permissions: + checks: write + contents: read + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # Keep this value in order to show the error comments + # also on edited files. + fetch-depth: 2 + + # If the workflow is triggered by a push use check reporter + # + # If the workflow is triggered by a PR coming from the + # same repository, the author has write access so we can + # use pr-review reporter since the GITHUB_TOKEN will have review + # write permissions + # + # Otherwise use annotation reporter that do not require any + # particular permission + # + # Why this? + # https://github.com/Valerioageno/tuono/pull/137#pullrequestreview-2455455272 + - name: Set reporter + id: reporter + env: + EVENT_NAME: ${{ github.event_name }} + FROM_MAIN_REPO: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} + run: | + echo "EVENT_NAME: $EVENT_NAME FROM_MAIN_REPO: $FROM_MAIN_REPO" + if [ "$EVENT_NAME" == 'push' ]; then + echo "name=github-check" >> $GITHUB_OUTPUT + elif [ "$FROM_MAIN_REPO" == 'true' ]; then + echo "name=github-pr-review" >> $GITHUB_OUTPUT + else + echo "name=github-pr-annotations" >> $GITHUB_OUTPUT + fi + + - name: Review dog languagetool + uses: reviewdog/action-languagetool@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + # Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. + reporter: ${{ steps.reporter.outputs.name }} + # Change reporter level if you need. + level: "warning" + patterns: "**/*.md **/*.txt **/*.mdx" + # enabled_categories: "STYLE,PLAIN_ENGLISH,WHITESPACE_RULE,EN_QUOTES,DASH_RULE,WORD_CONTAINS_UNDERSCORE,UPPERCASE_SENTENCE_START,ARROWS,COMMA_PARENTHESIS_WHITESPACE,UNLIKELY_OPENING_PUNCTUATION,SENTENCE_WHITESPACE,EN_UNPAIRED_BRACKETS,PHRASE_REPETITION,PUNCTUATION_PARAGRAPH_END" + disabled_categories: "" + disabled_rules: "" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..7af24b7 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.11.0 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..eeeb7be --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +pnpm-lock.yaml \ No newline at end of file diff --git a/README.md b/README.md index 3d59086..596f453 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ ## TODOs - [ ] add spell and grammar check -- [ ] add discord widget in profile? +- [ ] add discord widget in profile? diff --git a/package.json b/package.json new file mode 100644 index 0000000..10c19ef --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "tuono-org-github", + "version": "1.0.0", + "private": true, + "description": "", + "keywords": [], + "license": "MIT", + "packageManager": "pnpm@9.14.2+sha512.6e2baf77d06b9362294152c851c4f278ede37ab1eba3a55fda317a4a17b209f4dbb973fb250a77abc463a341fcb1f17f17cfa24091c4eb319cda0d9b84278387", + "scripts": { + "format": "prettier . --check", + "format:fix": "prettier . --write" + }, + "dependencies": { + "prettier": "3.3.3" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..7d3c3cc --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,24 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + prettier: + specifier: 3.3.3 + version: 3.3.3 + +packages: + + prettier@3.3.3: + resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + engines: {node: '>=14'} + hasBin: true + +snapshots: + + prettier@3.3.3: {}