diff --git a/.github/workflows/build-auto-generated-files.yml b/.github/workflows/build-auto-generated-files.yml new file mode 100644 index 0000000..3ee6368 --- /dev/null +++ b/.github/workflows/build-auto-generated-files.yml @@ -0,0 +1,11 @@ +--- +name: Build Auto-Generated Files +on: + workflow_dispatch: + +jobs: + build-contributors: + name: Build Auto-Generated Files + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/build-auto-generated-files-v2.yml@main + secrets: inherit + \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca7e651..8181bc6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,5 @@ --- -name: Deployment +name: Production Deployment on: push: branches: @@ -26,7 +26,9 @@ on: jobs: deployment: name: Deployment - uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy.yml@main + if: github.actor != 'adp-devsite-app[bot]' && github.repository != 'AdobeDocs/dev-docs-template' + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy-v2.yml@main + secrets: inherit with: env: ${{ inputs.env || 'prod' }} baseSha: ${{ inputs.baseSha || '' }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 863d6d2..bec32fe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,15 +3,47 @@ name: Lint on: pull_request: branches: [main] - paths: - - 'src/pages/**' jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Check for src/pages changes + id: changes + env: + BASE_REF: ${{ github.base_ref }} + run: | + git diff --name-only "origin/${BASE_REF}...HEAD" | grep -q '^src/pages/' \ + && echo "changed=true" >> $GITHUB_OUTPUT \ + || echo "changed=false" >> $GITHUB_OUTPUT - name: Lint + id: lint + if: steps.changes.outputs.changed == 'true' + continue-on-error: true run: npx --yes github:AdobeDocs/adp-devsite-utils runLint -v + + - name: Save PR number + if: always() + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: echo "$PR_NUMBER" > pr-number.txt + + - name: Upload linter report + if: always() + uses: actions/upload-artifact@v7 + with: + name: linter-report + path: | + linter-report.txt + pr-number.txt + if-no-files-found: ignore + + - name: Fail if linter found errors + if: steps.changes.outputs.changed == 'true' && steps.lint.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/post-lint-comment.yml b/.github/workflows/post-lint-comment.yml new file mode 100644 index 0000000..d2c75fd --- /dev/null +++ b/.github/workflows/post-lint-comment.yml @@ -0,0 +1,32 @@ +--- +name: Post Linter Report +on: + workflow_run: + workflows: ["Lint"] + types: + - completed + +permissions: + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' + steps: + - name: Download linter report artifact + uses: actions/download-artifact@v8 + with: + name: linter-report + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Post Linter Report to PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + LINTER_REPORT_PATH: ./linter-report.txt + PR_NUMBER_PATH: ./pr-number.txt + run: | + npm install --no-save github:AdobeDocs/adp-devsite-scripts + node node_modules/adp-devsite-scripts/linter-bot/postLinterReport.js diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index c96a42d..d108f50 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -15,7 +15,8 @@ on: jobs: deployment: name: Deployment - uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy.yml@main + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy-v2.yml@main + secrets: inherit with: env: stage baseSha: ${{ inputs.baseSha }} diff --git a/.gitignore b/.gitignore index becd8c2..4ee2f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,52 +1,16 @@ -# OS and IDE generated files # -############################## +# OS .DS_Store -.vscode -.history -.idea -.editorconfig - -# npm yarn -node_modules -package-lock.json -yarn-error.log -.pnp.* -.yarn/* -# keep in repo -!.gitignore -!.yarn.lock -!.yarnrc.yml -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/sdks -!.yarn/versions +# IDE +.vscode -# gatsby files +# environment variables .env -.cache -public - -# cypress -cypress/videos -cypress/screenshots -# lerna -lerna-debug.log - -# local actions -.actrc -.secrets -local-test.yml - -# yalc -.yalc -yalc.lock - -# json files -adp-site-metadata.json +# npm +node_modules +package-lock.json -#.txt +# generated by .github/workflows/lint.yml linter-report.txt diff --git a/dev.mjs b/dev.mjs deleted file mode 100644 index 84605fa..0000000 --- a/dev.mjs +++ /dev/null @@ -1,39 +0,0 @@ -// content/docs -// serve static on 3001 - -import express from 'express'; -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; -import { execSync } from 'child_process'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const PORT = process.env.DEV_PORT || 3003; - -const getCurrentBranch = () => { - try { - return execSync('git branch --show-current', { encoding: 'utf8' }).trim(); - } catch (error) { - console.warn('Could not determine git branch, defaulting to "main"'); - return 'main'; - } -}; - -const currentBranch = getCurrentBranch(); -const DOCS_DIRECTORY = process.env.DIRECTORY || './src/pages'; - -const app = express(); -console.log(path.resolve(__dirname, `./${DOCS_DIRECTORY}`)); -app.use( - express.static(path.resolve(__dirname, `./${DOCS_DIRECTORY}`), { - setHeaders: (res) => { - res.setHeader('last-modified', new Date().toGMTString()); - res.setHeader('local-branch-name', currentBranch); - }, - }), -); - -app.listen(PORT, () => { - console.debug(`Docs dev server is running on port ${PORT}`); -}); \ No newline at end of file diff --git a/package.json b/package.json index 84a803c..f8fa62e 100644 --- a/package.json +++ b/package.json @@ -8,24 +8,28 @@ "url": "https://github.com/AdobeDocs/stock-api-docs" }, "author": { - "name": "Stephan Ringel", - "url": "https://github.com/icaraps" + "name": "Tim Kim", + "url": "https://github.com/timkim" + }, + "engines": { + "node": "^24.11.0" }, "scripts": { - "dev": "node ./dev.mjs", - "buildNavigation": "npx --yes github:AdobeDocs/adp-devsite-utils buildNavigation -v", - "buildRedirections": "npx --yes github:AdobeDocs/adp-devsite-utils buildRedirections -v", - "renameFiles": "npx --yes github:AdobeDocs/adp-devsite-utils renameFiles -v", - "normalizeLinks": "npx --yes github:AdobeDocs/adp-devsite-utils normalizeLinks -v", - "buildSiteWideBanner": "npx --yes github:AdobeDocs/adp-devsite-utils buildSiteWideBanner -v", - "lint": "npx --yes github:AdobeDocs/adp-devsite-utils runLint -v", - "lint:errorOnly": "npx --yes github:AdobeDocs/adp-devsite-utils runLint", + "dev": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils dev", + "buildNavigation": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildNavigation -v", + "buildRedirections": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildRedirections -v", + "renameFiles": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils renameFiles -v", + "normalizeLinks": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils normalizeLinks -v", + "buildSiteWideBanner": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildSiteWideBanner -v", + "lint": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint -v", + "lint:errorOnly": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint", "link:skipdeadlinks": "npx --yes github:AdobeDocs/adp-devsite-utils runLint --skip-dead-links -v", "link:deadlinkonly": "npx --yes github:AdobeDocs/adp-devsite-utils runLint --dead-links-only -v", - "redirectCheck:stage": "npx --yes github:AdobeDocs/adp-devsite-utils redirectChecker stage --verbose", - "redirectCheck:prod": "npx --yes github:AdobeDocs/adp-devsite-utils redirectChecker prod --verbose" - }, - "devDependencies": { - "express": "5.1.0" + "redirectCheck:stage": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils redirectChecker stage --verbose", + "redirectCheck:prod": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils redirectChecker prod --verbose", + "buildSiteMetadata": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v", + "buildContributors": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildContributorsV2 -v", + "link:externalLinkOnly": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint --external-links-only -v", + "link:checkAllLinks": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint --internal-links-only --external-links-only -v" } }