Initial Setup #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: react-router Code Graph Analysis (TypeScript) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Ignore changes in documentation, general configuration and analysis-results for push events | |
| paths-ignore: | |
| - 'analysis-results/**' | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '**/*.css' | |
| - '**/*.html' | |
| - '**/*.js' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - 'renovate.json' | |
| - '**.code-workspace' | |
| - '.github/workflows/java-code-analysis.yml' | |
| - '.github/workflows/*documentation.yml' | |
| pull_request: | |
| branches: | |
| - main | |
| # Ignore changes in documentation, general configuration and analysis-results for pull request events | |
| paths-ignore: | |
| - 'analysis-results/**' | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '**/*.css' | |
| - '**/*.html' | |
| - '**/*.js' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - 'renovate.json' | |
| - '**.code-workspace' | |
| - '.github/workflows/java-code-analysis.yml' | |
| - '.github/workflows/*documentation.yml' | |
| jobs: | |
| prepare-code-to-analyze: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| analysis-name: ${{ steps.set-analysis-name.outputs.analysis-name }} | |
| sources-upload-name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }} | |
| env: | |
| PROJECT_NAME: react-router | |
| # Version variable name matches renovate.json configuration entry | |
| REACT_ROUTER_VERSION: 6.28.1 | |
| steps: | |
| - name: (Prepare Code to Analyze) Checkout react-router repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: remix-run/react-router | |
| ref: react-router@${{ env.REACT_ROUTER_VERSION }} | |
| - name: (Prepare Code to Analyze) Setup pnpm for react-router | |
| uses: pnpm/action-setup@v4.0.0 | |
| - name: (Prepare Code to Analyze) Install dependencies with pnpm | |
| run: pnpm install --frozen-lockfile --strict-peer-dependencies | |
| - name: (Prepare Code to Analyze) Set analysis-name | |
| id: set-analysis-name | |
| run: echo "analysis-name=${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}" >> "$GITHUB_OUTPUT" | |
| - name: (Prepare Code to Analyze) Generate ARTIFACT_UPLOAD_ID | |
| shell: bash | |
| run: echo "ARTIFACT_UPLOAD_ID=$(LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 10)" >> $GITHUB_ENV | |
| - name: (Prepare Code to Analyze) Set sources-upload-name | |
| id: set-sources-upload-name | |
| run: echo "sources-upload-name=${{ steps.set-analysis-name.outputs.analysis-name }}-analysis-sources_input-${{ env.ARTIFACT_UPLOAD_ID }}" >> "$GITHUB_OUTPUT" | |
| - name: (Prepare Code to Analyze) Upload code to analyze | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }} | |
| path: . | |
| if-no-files-found: error | |
| retention-days: 5 | |
| analyze-code-graph: | |
| needs: [prepare-code-to-analyze] | |
| uses: ./.github/workflows/analyze-code-graph.yml | |
| with: | |
| analysis-name: ${{ needs.prepare-code-to-analyze.outputs.analysis-name }} | |
| sources-upload-name: ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }} | |
| analysis-results: | |
| needs: [prepare-code-to-analyze, analyze-code-graph] | |
| runs-on: ubuntu-latest | |
| env: | |
| CI_COMMIT_MESSAGE: Automated code structure analysis analysis-results (CI) | |
| CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration | |
| steps: | |
| - name: Checkout GIT Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }} | |
| - name: (Code Analysis Setup) Download source code and artifacts for analysis | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }} | |
| path: analysis-results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }} | |
| # Commit and push the native image agent analysis-results | |
| - name: Display environment variable "github.event_name" | |
| run: echo "github.event_name=${{ github.event_name }}" | |
| - name: Display changes in the "analysis-results" directory and prepare commit | |
| # Only run when a pull request gets merged or a commit is pushed to the main branch | |
| # git add parameters need to match paths-ignore parameters above | |
| # Git pull before add/commit/push to reduce race conditions on parallel builds | |
| run: | | |
| git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}' | |
| git config --global user.email "7671054+JohT@users.noreply.github.com" | |
| git config --local http.postBuffer 524288000 | |
| git fetch origin | |
| git status | |
| git add analysis-results | |
| git status | |
| - name: Commit and push changes in the "analysis-results" directory | |
| # Only run when a pull request gets merged or a commit is pushed to the main branch | |
| # git add parameters need to match paths-ignore parameters above | |
| # Git pull before add/commit/push to reduce race conditions on parallel builds | |
| if: github.event_name == 'push' | |
| run: | | |
| git commit -m "${{ env.CI_COMMIT_MESSAGE }}" | |
| git status | |
| git rebase --strategy-option=theirs origin/main --verbose | |
| git status | |
| git push --verbose |