diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000..447aaa1 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,6 @@ +paths: + .github/workflows/**/*.{yml,yaml}: + ignore: + - '"inputs" section is alias node but mapping node is expected' + - '"paths" section must be sequence node but got alias node with "" tag' + - '"paths-ignore" section must be sequence node but got alias node with "" tag' diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 81e375f..6638313 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "monthly" diff --git a/.github/workflows/.issue.yaml b/.github/workflows/.issue.yaml new file mode 100644 index 0000000..cf19a80 --- /dev/null +++ b/.github/workflows/.issue.yaml @@ -0,0 +1,45 @@ +name: "Issue" + +on: + issues: + types: [opened] + +jobs: + issue: + name: "Issue" + if: ${{ !github.event.issue.type || github.event.issue.type.name == 'Bug' }} + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: write + issues: write + steps: + - name: "Checkout" + uses: actions/checkout@v6 + + - name: "Create App Token" + id: app + uses: actions/create-github-app-token@v3 + with: + app-id: 146360 + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: "AI Issue" + uses: smashedr/ai-issue-action@master + env: + GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }} + with: + token: ${{ steps.app.outputs.token }} + model: gemini-2.5-flash + instructions: | + You are a helpful assistant responding to a GitHub Issue created by user @${{ github.actor }} + in the repository ${{ github.server_url }}/${{ github.repository }} + Provide initial triage and troubleshooting steps, then gather any additional information needed to proceed. + Respond using your general knowledge of GitHub Workflows and the following knowledge files: + file: | + README.md + actions-lint.yaml + deploy-static.yaml + npm-build.yaml + tail: | + _Response generated by the [AI Issue Action](https://github.com/smashedr/ai-issue-action)._ diff --git a/.github/workflows/.lint.yaml b/.github/workflows/.lint.yaml index 6ffa3eb..26de2be 100644 --- a/.github/workflows/.lint.yaml +++ b/.github/workflows/.lint.yaml @@ -18,9 +18,9 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v5 + uses: actions/checkout@v6 - - name: "Prettier" + - name: "prettier" if: ${{ !cancelled() }} run: | echo "::group::Install" @@ -28,26 +28,18 @@ jobs: echo "::endgroup::" npx prettier --check . - - name: "Yamllint" + - name: "yamllint" if: ${{ !cancelled() }} + env: + CONFIG: .github/yamllint.yaml run: | echo "::group::List Files" - yamllint --list-files . + yamllint -c "${{ env.CONFIG }}" --list-files . echo "::endgroup::" - yamllint . + yamllint -c "${{ env.CONFIG }}" . - - name: "Actionlint" + - name: "actionlint" if: ${{ !cancelled() }} - run: | - echo "::group::Download" - loc=$(curl -sI https://github.com/rhysd/actionlint/releases/latest | grep -i '^location:') - echo "loc: ${loc}" - tag=$(echo "${loc}" | sed -E 's|.*/tag/v?(.*)|\1|' | tr -d '\t\r\n') - echo "tag: ${tag}" - url="https://github.com/rhysd/actionlint/releases/latest/download/actionlint_${tag}_linux_amd64.tar.gz" - echo "url: ${url}" - curl -sL "${url}" | tar xz -C "${RUNNER_TEMP}" actionlint - file "${RUNNER_TEMP}/actionlint" - "${RUNNER_TEMP}/actionlint" --version - echo "::endgroup::" - "${RUNNER_TEMP}/actionlint" -color -verbose -shellcheck= -pyflakes= + uses: cssnr/actionlint-action@v1 + with: + shellcheck_opts: -e SC2129 diff --git a/.github/workflows/deploy-static.yaml b/.github/workflows/deploy-static.yaml index 9d71610..329d4ef 100644 --- a/.github/workflows/deploy-static.yaml +++ b/.github/workflows/deploy-static.yaml @@ -31,10 +31,6 @@ on: path: type: string -#concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true - jobs: deploy: name: "Deploy" @@ -46,14 +42,8 @@ jobs: url: ${{ inputs.url }} steps: - - name: "Debug CTX github" - continue-on-error: true - env: - GITHUB_CTX: ${{ toJSON(github) }} - run: echo "$GITHUB_CTX" - - name: "Download Artifact" - uses: actions/download-artifact@v6 + uses: actions/download-artifact@v8 with: name: ${{ inputs.artifact }} @@ -102,8 +92,8 @@ jobs: SSHPASS: ${{ secrets.pass }} run: | sshpass -e rsync -aPvh --delete -e \ - 'ssh -p ${{ secrets.port }} -o ConnectTimeout=30' \ - ./ "${{ secrets.user }}"@"${{ secrets.host }}":"${{ inputs.dest }}" + "ssh -p ${{ secrets.port }} -o ConnectTimeout=30" \ + ./ "${{ secrets.user }}@${{ secrets.host }}:${{ inputs.dest }}" - name: "Send Discord Notification" if: ${{ env.webhook }} diff --git a/.github/workflows/lint-actions.yaml b/.github/workflows/lint-actions.yaml index e2a8799..2836600 100644 --- a/.github/workflows/lint-actions.yaml +++ b/.github/workflows/lint-actions.yaml @@ -41,7 +41,7 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: "Setup Node" if: ${{ inputs.node-version != '' }} diff --git a/.github/workflows/npm-build.yaml b/.github/workflows/npm-build.yaml index 028e2a5..ddc8687 100644 --- a/.github/workflows/npm-build.yaml +++ b/.github/workflows/npm-build.yaml @@ -21,10 +21,6 @@ on: secrets: webhook: -#concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true - jobs: build: name: "Build" @@ -39,7 +35,7 @@ jobs: run: echo "$GITHUB_CTX" - name: "Checkout" - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -71,7 +67,7 @@ jobs: - name: "Upload Artifact" if: ${{ !inputs.pages }} - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v7 with: name: ${{ inputs.name }} path: ${{ inputs.path }} @@ -80,7 +76,7 @@ jobs: - name: "Upload Pages Artifact" if: ${{ inputs.pages }} - uses: actions/upload-pages-artifact@v4 + uses: actions/upload-pages-artifact@v5 with: path: ${{ inputs.path }} diff --git a/.github/yamllint.yaml b/.github/yamllint.yaml new file mode 100644 index 0000000..ccf5e5e --- /dev/null +++ b/.github/yamllint.yaml @@ -0,0 +1,7 @@ +extends: relaxed + +ignore-from-file: .gitignore + +rules: + line-length: + max: 120 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..db82eec --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +.github/disabled +.github/pull_request_template.md +package-lock.json diff --git a/.prettierrc.json b/.prettierrc.json index 0967ef4..577fddf 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1 +1,21 @@ -{} +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": false, + "singleQuote": true, + "printWidth": 90, + "overrides": [ + { + "files": ["**/*.vue"], + "options": { + "printWidth": 120 + } + }, + { + "files": ["**/*.html", "**/*.yaml", "**/*.yml"], + "options": { + "singleQuote": false, + "printWidth": 120 + } + } + ] +} diff --git a/README.md b/README.md index f9ebcbe..b0bb561 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -[![Workflow Lint](https://img.shields.io/github/actions/workflow/status/cssnr/workflows/.lint.yaml?logo=cachet&label=lint)](https://github.com/cssnr/workflows/actions/workflows/.lint.yaml) -[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/workflows?logo=vitepress&logoColor=white&label=updated)](https://github.com/cssnr/workflows/pulse) -[![GitHub Contributors](https://img.shields.io/github/contributors-anon/cssnr/workflows?logo=github)](https://github.com/cssnr/workflows/graphs/contributors) -[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/workflows?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/workflows) -[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/workflows?logo=github)](https://github.com/cssnr/workflows/discussions) -[![GitHub Repo Stars](https://img.shields.io/github/stars/cssnr/workflows?style=flat&logo=github)](https://github.com/cssnr/workflows/stargazers) -[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&label=org%20stars)](https://cssnr.github.io/) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/workflows?logo=listenhub&label=updated)](https://github.com/cssnr/workflows/pulse) +[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/workflows?logo=buffer&label=repo%20size)](https://github.com/cssnr/workflows?tab=readme-ov-file#readme) +[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/workflows?logo=devbox)](https://github.com/cssnr/workflows?tab=readme-ov-file#readme) +[![GitHub Contributors](https://img.shields.io/github/contributors-anon/cssnr/workflows?logo=southwestairlines)](https://github.com/cssnr/workflows/graphs/contributors) +[![GitHub Issues](https://img.shields.io/github/issues/cssnr/workflows?logo=codeforces&logoColor=white)](https://github.com/cssnr/workflows/issues) +[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/workflows?logo=theconversation)](https://github.com/cssnr/workflows/discussions) +[![GitHub Forks](https://img.shields.io/github/forks/cssnr/workflows?style=flat&logo=forgejo&logoColor=white)](https://github.com/cssnr/workflows/forks) +[![GitHub Repo Stars](https://img.shields.io/github/stars/cssnr/workflows?style=flat&logo=gleam&logoColor=white)](https://github.com/cssnr/workflows/stargazers) +[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=apachespark&logoColor=white&label=org%20stars)](https://cssnr.github.io/) [![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY) [![Ko-fi](https://img.shields.io/badge/Ko--fi-72a5f2?logo=kofi&label=support)](https://ko-fi.com/cssnr) @@ -28,31 +30,31 @@ Example using both workflows: [django-files/django-files.github.io/dev.yaml](htt ```yaml jobs: build: - name: "Build" + name: 'Build' if: ${{ !contains(github.event.head_commit.message, '#nodev') }} uses: cssnr/workflows/.github/workflows/npm-build.yaml@master permissions: contents: read with: - install: "npm ci" # install command - build: "npm run build" # build command - path: "dist" # directory of artifacts - name: "artifact" # artifact name + install: 'npm ci' # install command + build: 'npm run build' # build command + path: 'dist' # directory of artifacts + name: 'artifact' # artifact name pages: false # create a pages artifact secrets: webhook: ${{ secrets.webhook }} # failure notification # Example Usage deploy: - name: "Deploy" + name: 'Deploy' needs: build runs-on: ubuntu steps: - - name: "Download Artifact" + - name: 'Download Artifact' uses: actions/download-artifact@v5 with: - name: "artifact" - - name: "Debug" + name: 'artifact' + - name: 'Debug' run: ls -lAh . ``` @@ -62,25 +64,25 @@ jobs: jobs: build: # Example Usage - - name: "Upload Artifact" + - name: 'Upload Artifact' uses: actions/upload-artifact@v4 with: path: dist - name: "artifact" + name: 'artifact' deploy: - name: "Deploy" + name: 'Deploy' uses: cssnr/workflows/github/workflows/deploy-static.yaml needs: build permissions: contents: read with: - name: "dev" # Environment name and url - url: "https://dev-static.cssnr.com/github-projects" - path: "github-projects" # Optional path/subdirectory + name: 'dev' # Environment name and url + url: 'https://dev-static.cssnr.com/github-projects' + path: 'github-projects' # Optional path/subdirectory robots: true # Add robots.txt to block robots - artifact: "artifact" # Custom artifact name - dest: "/static" # Target rsync destination + artifact: 'artifact' # Custom artifact name + dest: '/static' # Target rsync destination secrets: host: ${{ secrets.DEV_DEPLOY_HOST }} port: ${{ secrets.DEV_DEPLOY_PORT }}