-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (101 loc) · 4.38 KB
/
internal-typescript-code-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Typescript Code Structure Graph Analysis
on:
push:
branches:
- main
# Ignore changes in documentation, general configuration and reports for push events
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.css'
- '**/*.html'
- '**/*.js'
- '.gitignore'
- '.gitattributes'
- 'renovate.json'
- 'renovate-presets/**'
- 'changelogTemplate.mustache'
- '**.code-workspace'
- '.github/workflows/internal-java-code-analysis.yml'
- '.github/workflows/*documentation.yml'
pull_request:
branches:
- main
# Ignore changes in documentation, general configuration and reports for pull request events
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.css'
- '**/*.html'
- '**/*.js'
- '.gitignore'
- '.gitattributes'
- 'renovate.json'
- 'renovate-presets/**'
- 'changelogTemplate.mustache'
- '**.code-workspace'
- '.github/workflows/internal-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.2
steps:
- name: (Prepare Code to Analyze) Checkout GIT repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set Set output variable 'analysis-name'
id: set-analysis-name
run: echo "analysis-name=${{ env.PROJECT_NAME }}-${{ env.REACT_ROUTER_VERSION }}" >> "$GITHUB_OUTPUT"
- name: Setup temp directory if missing
run: mkdir -p ./temp
- name: Setup Cache for "temp/downloads" folder
uses: actions/cache@v4
with:
path: ./temp/downloads
key:
${{ runner.os }}-${{ hashFiles('**/*.sh') }}
- name: Download ${{ steps.set-analysis-name.outputs.analysis-name }}
working-directory: temp
run: |
mkdir -p ${{ steps.set-analysis-name.outputs.analysis-name }}
cd ${{ steps.set-analysis-name.outputs.analysis-name }}
echo "Working directory: $( pwd -P )"
./../../scripts/downloader/downloadReactRouter.sh ${{ env.REACT_ROUTER_VERSION }}
- name: (Prepare Code to Analyze) Setup pnpm for react-router
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
package_json_file: temp/${{ steps.set-analysis-name.outputs.analysis-name }}/source/${{ steps.set-analysis-name.outputs.analysis-name }}/package.json
- name: (Prepare Code to Analyze) Install dependencies with pnpm
working-directory: temp/${{ steps.set-analysis-name.outputs.analysis-name }}/source/${{ steps.set-analysis-name.outputs.analysis-name }}
run: pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Debug folder structure in temp directory
if: runner.debug == '1'
working-directory: temp
run: |
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
- name: (Prepare Code to Analyze) Generate ARTIFACT_UPLOAD_ID
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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
path: ./temp/${{ steps.set-analysis-name.outputs.analysis-name }}/source
include-hidden-files: true
if-no-files-found: error
retention-days: 1
analyze-code-graph:
needs: [prepare-code-to-analyze]
uses: ./.github/workflows/public-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 }}