diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d275346 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + groups: + actions-minor: + update-types: + - minor + - patch + + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + ignore: + - dependency-name: '@types/node' + update-types: + - 'version-update:semver-major' + groups: + npm-development: + dependency-type: development + update-types: + - minor + - patch + npm-production: + dependency-type: production + update-types: + - patch diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml new file mode 100644 index 0000000..5c4bd8b --- /dev/null +++ b/.github/workflows/check-dist.yml @@ -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/ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 21b12f0..5f8e060 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,71 +1,48 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" +name: CodeQL on: - push: - branches: [ main ] pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] + branches: + - main + push: + branches: + - main schedule: - - cron: '31 5 * * 5' + - cron: '31 7 * * 3' + +permissions: + actions: read + checks: write + contents: read + security-events: write jobs: analyze: name: Analyze runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write strategy: fail-fast: false matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support + language: + - TypeScript steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout + id: checkout + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - source-root: src - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + - name: Initialize CodeQL + id: initialize + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + source-root: src - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + - name: Autobuild + id: autobuild + uses: github/codeql-action/autobuild@v3 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + id: analyze + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..ba26ac8 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,44 @@ +name: Continuous Integration + +on: + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + checks: write + contents: read + +jobs: + continuous-integration: + name: Continuous Integration + 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: Check Format + id: format-check + run: npm run format:check + + - name: Lint + id: lint + run: npm run lint + + - name: Test + id: test + run: npm run ci-test diff --git a/.github/workflows/first-interaction.yml b/.github/workflows/first-interaction.yml index c409fa5..7262609 100644 --- a/.github/workflows/first-interaction.yml +++ b/.github/workflows/first-interaction.yml @@ -1,18 +1,22 @@ -name: first-interaction +name: First Interaction on: issues: - types: [opened] + types: + - opened pull_request: - branches: [main] - types: [opened] + branches: + - main + types: + - opened jobs: - check_for_first_interaction: + first-interaction: + name: First Interaction runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 - - uses: actions/first-interaction@main + - uses: actions/first-interaction@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: | @@ -21,8 +25,7 @@ jobs: If this is a bug report, please include relevant logs to help us debug the problem. pr-message: | Hello! Thank you for your contribution. - + If you are fixing a bug, please reference the issue number in the description. If you are implementing a feature request, please check with the maintainers that the feature will be accepted first. - \ No newline at end of file diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index 804196c..0c51558 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -1,20 +1,73 @@ +# This workflow checks the statuses of cached dependencies used in this action +# with the help of the Licensed tool. If any licenses are invalid or missing, +# this workflow will fail. See: https://github.com/licensee/licensed + name: Licensed on: - push: {branches: main} - pull_request: {branches: main} + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: write jobs: - test: + licensed: + name: Check Licenses runs-on: ubuntu-latest - name: Check licenses + steps: - - uses: actions/checkout@v2 - - run: npm install - - name: Install licensed + - 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: Setup Ruby + id: setup-ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ruby + + - name: Setup Licensed + id: setup-licensed + uses: licensee/setup-licensed@v1.3.2 + with: + version: 4.x + github_token: ${{ secrets.GITHUB_TOKEN }} + + # If this is a workflow_dispatch event, update the cached licenses. + - if: ${{ github.event_name == 'workflow_dispatch' }} + name: Update Licenses + id: update-licenses + run: licensed cache + + # Then, commit the updated licenses to the repository. + - if: ${{ github.event_name == 'workflow_dispatch' }} + name: Commit Licenses + id: commit-licenses run: | - cd $RUNNER_TEMP - curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz - sudo tar -xzf licensed.tar.gz - sudo mv licensed /usr/local/bin/licensed - - run: licensed status \ No newline at end of file + git config --local user.email "licensed-ci@users.noreply.github.com" + git config --local user.name "licensed-ci" + git add . + git commit -m "Auto-update license files" + git push + + # Last, check the status of the cached licenses. + - name: Check Licenses + id: check-licenses + run: licensed status diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..8c0f6f0 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,53 @@ +name: Lint Codebase + +on: + pull_request: + branches: + - main + push: + branches: + - main + +permissions: + contents: read + packages: read + statuses: write + +jobs: + lint: + name: Lint Codebase + runs-on: ubuntu-latest + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - 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: Lint Codebase + id: super-linter + uses: super-linter/super-linter/slim@v7 + env: + DEFAULT_BRANCH: main + FILTER_REGEX_EXCLUDE: dist/**/* + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LINTER_RULES_PATH: ${{ github.workspace }} + VALIDATE_ALL_CODEBASE: true + VALIDATE_JAVASCRIPT_ES: false + VALIDATE_JAVASCRIPT_STANDARD: false + VALIDATE_JSCPD: false + VALIDATE_TYPESCRIPT_ES: false + VALIDATE_JSON: false + VALIDATE_TYPESCRIPT_STANDARD: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff881b9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + name: Release Version + runs-on: ubuntu-latest + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Tag + id: tag + uses: issue-ops/semver@v2 + with: + manifest-path: package.json + workspace: ${{ github.workspace }} + ref: main + + - name: Create Release + id: release + uses: issue-ops/releaser@v2 + with: + tag: v${{ steps.tag.outputs.version }}