diff --git a/.github/workflows/algolia-indexing.yml b/.github/workflows/algolia-indexing.yml deleted file mode 100644 index 173d58c..0000000 --- a/.github/workflows/algolia-indexing.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: Search Indexing -on: - workflow_dispatch: - inputs: - mode: - description: 'Type of indexing. "index" to push to Algolia, "console" for dry run.' - required: true - default: "index" - type: choice - options: - - console - - index - -jobs: - build-and-index: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node v18 for Yarn v4 - uses: actions/setup-node@v3 - with: - node-version: "18.19.0" # Current LTS version - - - name: Enable Corepack for Yarn - run: corepack enable - - - name: Install Dependencies - run: yarn install - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false - - - name: Build site - run: yarn build - - env: - NODE_OPTIONS: "--max_old_space_size=8192" - PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' - REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_OWNER: ${{ github.repository_owner }} - REPO_NAME: ${{ github.event.repository.name }} - REPO_BRANCH: ${{ github.ref_name }} - GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} - GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} - ALGOLIA_WRITE_API_KEY: ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }} - ALGOLIA_INDEXATION_MODE: ${{ github.event.inputs.mode || 'index' }} - GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }} - GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} - GATSBY_SITE_DOMAIN_URL: https://developer.adobe.com diff --git a/.github/workflows/build-site-metadata.yml b/.github/workflows/build-auto-generated-files.yml similarity index 65% rename from .github/workflows/build-site-metadata.yml rename to .github/workflows/build-auto-generated-files.yml index 7c746d1..3ee6368 100644 --- a/.github/workflows/build-site-metadata.yml +++ b/.github/workflows/build-auto-generated-files.yml @@ -1,13 +1,11 @@ --- name: Build Auto-Generated Files on: - pull_request: workflow_dispatch: jobs: build-contributors: name: Build Auto-Generated Files - if: github.repository != 'AdobeDocs/dev-docs-template' - uses: AdobeDocs/adp-devsite-workflow/.github/workflows/build-auto-generated-files.yml@main + 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 5891b43..8181bc6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 7b703cd..4ee2f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,16 @@ -# OS and IDE generated files # -############################## +# OS .DS_Store -.vscode -.history -.idea -.editorconfig - -# npm yarn -node_modules -package.lock -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 +# npm +node_modules +package-lock.json -# yalc -.yalc -yalc.lock \ No newline at end of file +# generated by .github/workflows/lint.yml +linter-report.txt diff --git a/package.json b/package.json index 2a0f0ec..1ed6300 100644 --- a/package.json +++ b/package.json @@ -8,19 +8,22 @@ "url": "https://github.com/AdobeDocs/cc-libraries-api" }, "scripts": { - "dev": "npx --yes github:AdobeDocs/adp-devsite-utils dev", - "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", - "buildSiteMetadata": "npx --yes github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v", - "buildContributors": "npx --yes github:AdobeDocs/adp-devsite-utils buildContributors -v", - "lint": "npx --yes github:AdobeDocs/adp-devsite-utils runLint -v", - "lint:errorOnly": "npx --yes github:AdobeDocs/adp-devsite-utils runLint", - "link:externalLinkOnly": "npx --yes github:AdobeDocs/adp-devsite-utils runLint --external-links-only -v", - "link:checkAllLinks": "npx --yes github:AdobeDocs/adp-devsite-utils runLint --internal-links-only --external-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" + "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", + "buildSiteMetadata": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v", + "buildContributors": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildContributorsV2 -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: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", + "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" + }, + "engines": { + "node": "^24.11.0" } }