File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ outputs:
77 primaryLanguage :
88 description : ' Detected primary language for the repository'
99runs :
10- using : ' node20'
11- main : ' dist/index.js'
10+ using : ' composite'
11+ steps :
12+ - run : bash ${{ github.action_path }}/src/get-primary-language.sh
13+ shell : bash
1214
1315branding :
1416 icon : ' flag'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ # Get the repository root directory
6+ REPO_ROOT=" ${GITHUB_WORKSPACE:- .} "
7+
8+ # Check for Go indicators
9+ if [[ -f " $REPO_ROOT /.goreleaser" ]] || [[ -f " $REPO_ROOT /go.mod" ]]; then
10+ echo " primary_language=Go" >> " $GITHUB_OUTPUT "
11+ echo " Detected primary language: Go"
12+ exit 0
13+ fi
14+
15+ # Check for C# indicators
16+ if [[ -f " $REPO_ROOT /.sln" ]]; then
17+ echo " primary_language='C#'" >> " $GITHUB_OUTPUT "
18+ echo " Detected primary language: C#"
19+ exit 0
20+ fi
21+
22+ # Check for .csproj files within one level deep
23+ if find " $REPO_ROOT " -maxdepth 2 -name " *.csproj" -type f | grep -q . ; then
24+ echo " primary_language='C#'" >> " $GITHUB_OUTPUT "
25+ echo " Detected primary language: C#"
26+ exit 0
27+ fi
28+
29+ # No primary language detected
30+ echo " primary_language=Unknown" >> " $GITHUB_OUTPUT "
31+ echo " No primary language detected"
You can’t perform that action at this time.
0 commit comments