diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml deleted file mode 100644 index 9d312abac0a5..000000000000 --- a/.github/workflows/copilot-setup-steps.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: 'Copilot Environment Setup' - -# **What it does**: Sets up the environment for Copilot coding agent to test content and script changes. -# **Why we have it**: Ensures Copilot can validate content with linters and formatters before making changes. -# **Who does it impact**: Copilot coding agent and developers using repository custom instructions. - -on: - workflow_dispatch: - inputs: - check_content: - description: 'Check content files with content linter' - required: false - default: true - type: boolean - check_scripts: - description: 'Check TypeScript/JavaScript/SCSS files with prettier and linter' - required: false - default: true - type: boolean - paths: - description: 'Specific file paths to check (space-separated), or leave empty for changed files' - required: false - type: string - -permissions: - contents: read - -jobs: - copilot-setup-steps: - if: github.repository == 'github/docs-internal' - runs-on: ${{ github.repository == 'github/docs-internal' && 'ubuntu-20.04-xl' || 'ubuntu-latest' }} - - steps: - - name: Check out repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Set up Node and dependencies - uses: ./.github/actions/node-npm-setup - - - name: Get changed files if no specific paths provided - if: inputs.paths == '' - id: changed_files - uses: ./.github/actions/get-changed-files - with: - files: | - content/** - data/** - src/**/*.{ts,tsx,js,mjs} - **/*.scss - - - name: Set file paths for checking - id: set_paths - run: | - if [ -n "${{ inputs.paths }}" ]; then - echo "files_to_check=${{ inputs.paths }}" >> $GITHUB_OUTPUT - else - echo "files_to_check=${{ steps.changed_files.outputs.filtered_changed_files }}" >> $GITHUB_OUTPUT - fi - - - name: Run content linter on content/data files - if: inputs.check_content == true && (contains(steps.set_paths.outputs.files_to_check, 'content/') || contains(steps.set_paths.outputs.files_to_check, 'data/')) - env: - FILES_TO_CHECK: ${{ steps.set_paths.outputs.files_to_check }} - run: | - # Filter for content and data files only - CONTENT_FILES=$(echo "$FILES_TO_CHECK" | tr ' ' '\n' | grep -E '^(content|data)/' | tr '\n' ' ' || true) - if [ -n "$CONTENT_FILES" ]; then - echo "Running content linter on: $CONTENT_FILES" - npm run lint-content -- --paths $CONTENT_FILES - else - echo "No content or data files to check" - fi - - - name: Run prettier check on script files - if: inputs.check_scripts == true - env: - FILES_TO_CHECK: ${{ steps.set_paths.outputs.files_to_check }} - run: | - # Filter for TypeScript, JavaScript, and SCSS files - SCRIPT_FILES=$(echo "$FILES_TO_CHECK" | tr ' ' '\n' | grep -E '\.(ts|tsx|js|mjs|scss)$' | tr '\n' ' ' || true) - if [ -n "$SCRIPT_FILES" ]; then - echo "Running prettier check on: $SCRIPT_FILES" - npm run prettier-check -- $SCRIPT_FILES - else - echo "No script files to check with prettier" - fi - - - name: Run ESLint on script files - if: inputs.check_scripts == true - env: - FILES_TO_CHECK: ${{ steps.set_paths.outputs.files_to_check }} - run: | - # Filter for TypeScript and JavaScript files only (ESLint doesn't handle SCSS) - SCRIPT_FILES=$(echo "$FILES_TO_CHECK" | tr ' ' '\n' | grep -E '\.(ts|tsx|js|mjs)$' | tr '\n' ' ' || true) - if [ -n "$SCRIPT_FILES" ]; then - echo "Running ESLint on: $SCRIPT_FILES" - npx eslint $SCRIPT_FILES - else - echo "No JavaScript/TypeScript files to lint" - fi - - - name: Run TypeScript compiler check - if: inputs.check_scripts == true && (contains(steps.set_paths.outputs.files_to_check, '.ts') || contains(steps.set_paths.outputs.files_to_check, '.tsx')) - run: | - echo "Running TypeScript compiler check" - npm run tsc - - - name: Environment setup summary - run: | - echo "✅ Copilot environment setup completed successfully!" - echo "" - echo "Available commands for content validation:" - echo "- Content linting: npm run lint-content -- --paths " - echo "- Prettier formatting: npm run prettier-check -- " - echo "- ESLint: npm run lint" - echo "- TypeScript check: npm run tsc" - echo "- All tests: npm test" - echo "" - echo "For more guidance, see .github/copilot-instructions.md"