diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a3a14b6..d7794a8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,97 +1,94 @@ { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "ghcr.io/devcontainers/features/github-cli:1": {}, - "ghcr.io/devcontainers/features/go:1": { - "version": "1.24" - }, - "ghcr.io/github/features/goproxy:1": {}, - "ghcr.io/github/features/go-linter:2": {}, - "ghcr.io/devcontainers/features/sshd:1": { - "version": "latest" - }, - "ghcr.io/devcontainers/features/node:1": { - "nodeGypDependencies": true, - "version": "lts", - "nvmVersion": "latest" - }, - "ghcr.io/devcontainers/features/hugo:1": { - "extended": true, - "version": "latest" - } - }, - "onCreateCommand": ".devcontainer/on-create-command.sh", - "postCreateCommand": "./tools/setup", - "containerEnv": { - "GOPROXY": "https://goproxy.githubapp.com/mod,https://proxy.golang.org/,direct", - "GOPRIVATE": "", - "GONOPROXY": "", - "GONOSUMDB": "github.com/github/*" - }, - "customizations": { - "vscode": { - "extensions": [ - "golang.go", - // Recommended for Hextra theme - "mhutchie.git-graph", - "esbenp.prettier-vscode", - "tamasfe.even-better-toml", - "budparr.language-hugo-vscode", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "containerUser": "vscode", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/go:1": { + "version": "1.24" + }, + "ghcr.io/github/features/goproxy:1": {}, + "ghcr.io/github/features/go-linter:2": {}, + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "lts", + "nvmVersion": "latest" + }, + "ghcr.io/devcontainers/features/hugo:1": { + "extended": true, + "version": "latest" + } + }, + "onCreateCommand": ".devcontainer/on-create-command.sh", + "postCreateCommand": "./tools/setup", + "containerEnv": { + "GOPROXY": "https://goproxy.githubapp.com/mod,https://proxy.golang.org/,direct", + "GOPRIVATE": "", + "GONOPROXY": "", + "GONOSUMDB": "github.com/github/*" + }, + "customizations": { + "vscode": { + "extensions": [ + "golang.go", + // Recommended for Hextra theme + "mhutchie.git-graph", + "prettier.prettier-vscode", + "tamasfe.even-better-toml", + "budparr.language-hugo-vscode", - // Recommended extensions from https://gohugo.io/tools/editors/#visual-studio-code - // Front Matter CMS: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter - "eliostruyf.vscode-front-matter", - - // Hugo Helper: https://marketplace.visualstudio.com/items?itemName=rusnasonov.vscode-hugo - "rusnasonov.vscode-hugo", - - // Hugo Language and Syntax Support: https://marketplace.visualstudio.com/items?itemName=budparr.language-hugo-vscode - "budparr.language-hugo-vscode", - - // Hugo Themer: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hugo-themer - "eliostruyf.vscode-hugo-themer", - - // hugofy: https://marketplace.visualstudio.com/items?itemName=akmittal.hugofy - "akmittal.hugofy", - - // Hugo Shortcode Syntax Highlighting: https://marketplace.visualstudio.com/items?itemName=kaellarkin.hugo-shortcode-syntax - "kaellarkin.hugo-shortcode-syntax" - ], - "settings": { - "go.lintFlags": [ - "--config=/workspaces/.golangci.toml", - "--whole-files", - "--new-from-rev=origin/main" - ] - } - }, - "codespaces": { - "repositories": { - "github/go-linter": { - "permissions": { - "contents": "read", - "packages": "read" - } - }, - "github/features": { - "permissions": { - "contents": "read", - "packages": "read" - } - }, - "github/*": { - "permissions": { - "contents": "read", - "packages": "read" - } - } - } - } - }, - "forwardPorts": [1313], - "portsAttributes": { - "8080": { - "label": "dev-server" - } - } + // Recommended extensions from https://gohugo.io/tools/editors/#visual-studio-code + "eliostruyf.vscode-front-matter", + "rusnasonov.vscode-hugo", + "budparr.language-hugo-vscode", + "eliostruyf.vscode-hugo-themer", + "akmittal.hugofy", + "kaellarkin.hugo-shortcode-syntax" + ], + "settings": { + "go.lintFlags": [ + "--config=/workspaces/.golangci.toml", + "--whole-files", + "--new-from-rev=origin/main" + ], + "editor.defaultFormatter": "prettier.prettier-vscode", + "editor.tabSize": 2, + "editor.insertSpaces": true, + "editor.detectIndentation": false, + "prettier.requireConfig": true, + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true + } + }, + "codespaces": { + "repositories": { + "github/go-linter": { + "permissions": { + "contents": "read", + "packages": "read" + } + }, + "github/features": { + "permissions": { + "contents": "read", + "packages": "read" + } + }, + "github/*": { + "permissions": { + "contents": "read", + "packages": "read" + } + } + } + } + }, + "forwardPorts": [1313], + "portsAttributes": { + "8080": { + "label": "dev-server" + } + } } diff --git a/.github/dependabot.yaml b/.github/dependabot.yml similarity index 88% rename from .github/dependabot.yaml rename to .github/dependabot.yml index da68f5a..f67cb93 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "daily" labels: - "CI/CD" - "dependabot" @@ -16,7 +16,7 @@ updates: - package-ecosystem: "npm" directory: "/" schedule: - interval: "weekly" + interval: "daily" groups: npm-deps: patterns: diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 7996b47..d7b1661 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -28,6 +28,13 @@ jobs: with: fetch-depth: 0 + - uses: actions/setup-node@v6 + with: + node-version: lts/* + + - name: Install dependencies + run: npm ci -o + - uses: super-linter/super-linter/slim@502f4fe48a81a392756e173e39a861f8c8efe056 # v8.3.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -84,7 +91,7 @@ jobs: # Note: The -o flag is required to install optional # dependencies that include pre-built binaries for tailwindcss # when running in a CI environment. - # + # # See: https://github.com/tailwindlabs/tailwindcss/issues/15806 npm ci -o @@ -124,8 +131,8 @@ jobs: - name: Upload Pages artifact uses: actions/upload-pages-artifact@v4 with: - path: "./${{ env.SITE_DIR }}" - retention-days: "7" + path: './${{ env.SITE_DIR }}' + retention-days: '7' - name: Deploy site to GitHub Pages id: deployment diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 0000000..a938278 --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,111 @@ +# PR Labeling Workflow +# +# Purpose: Automatically applies and removes labels on pull requests based on their status +# to improve visibility and workflow management. +# +# Triggers: +# - Pull request converted to draft +# - Pull request marked as ready for review +# - Pull request opened +# - Pull request reopened +# - Pull request closed +# +# How it works: +# - Uses GitHub CLI to modify PR labels based on the event action. +# - Continues execution even if label operations fail (uses `|| true`). +# +# Permissions: +# - pull-requests: write (required to add/remove labels) + +name: Label PR +on: + pull_request: + types: + - converted_to_draft + - ready_for_review + - opened + - reopened + - closed + +permissions: + pull-requests: write + +env: + DRAFT_LABEL: "draft" + READY_LABEL: "ready for review" + +jobs: + pr-in-draft-label: + if: github.event.action == 'converted_to_draft' + runs-on: ubuntu-latest + steps: + - name: Add/Remove PR labels based on event type + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + EVENT_ACTION: ${{ github.event.action }} + ADD_LABEL: ${{ env.DRAFT_LABEL }} + REMOVE_LABEL: ${{ env.READY_LABEL }} + run: &update_run | + gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "$ADD_LABEL" || true + gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "$REMOVE_LABEL" || true + echo "Labels updated based on event action: $EVENT_ACTION for PR #$PR_NUMBER" >> "$GITHUB_STEP_SUMMARY" + + pr-ready-review-label: + if: github.event.action == 'ready_for_review' + runs-on: ubuntu-latest + steps: + - name: Add/Remove PR labels based on event type + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + EVENT_ACTION: ${{ github.event.action }} + ADD_LABEL: ${{ env.READY_LABEL }} + REMOVE_LABEL: ${{ env.DRAFT_LABEL }} + run: *update_run + + open-pr-label: + if: github.event.action == 'opened' || github.event.action == 'reopened' + runs-on: ubuntu-latest + steps: + - name: Set labels based on draft status + shell: bash + run: | + if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then + echo "ADD_LABEL_VALUE=${{ env.DRAFT_LABEL }}" >> $GITHUB_ENV + echo "REMOVE_LABEL_VALUE=${{ env.READY_LABEL }}" >> $GITHUB_ENV + else + echo "ADD_LABEL_VALUE=${{ env.READY_LABEL }}" >> $GITHUB_ENV + echo "REMOVE_LABEL_VALUE=${{ env.DRAFT_LABEL }}" >> $GITHUB_ENV + fi + + - name: Add/Remove PR labels based on event type + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + EVENT_ACTION: ${{ github.event.action }} + ADD_LABEL: ${{ env.ADD_LABEL_VALUE }} + REMOVE_LABEL: ${{ env.REMOVE_LABEL_VALUE }} + run: *update_run + + close-remove-labels: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Add/Remove PR labels based on event type + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + EVENT_ACTION: ${{ github.event.action }} + run: | + gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "${{ env.DRAFT_LABEL }}" || true + gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "${{ env.READY_LABEL }}" || true + echo "Removed labels based on event action: $EVENT_ACTION for PR #$PR_NUMBER" >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index fc32e7e..2692d5b 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,12 @@ Run only functional tests: tools/test --functional ``` +Run linter: + +```bash +tools/lint +``` + Review test output for errors and address any failures before submitting changes. For more detailed development instructions, including GitHub Codespaces setup, see the [Contributing Guide](CONTRIBUTING.md).