Skip to content

Commit 0898ceb

Browse files
author
Kevin Mack
committed
Moving to dynamic install
1 parent cd9eccb commit 0898ceb

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

.github/workflows/codeql.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,61 @@ jobs:
7575
--mount-workspace-git-root true
7676
echo $?
7777
78+
- name: install-codeql
79+
shell: bash
80+
run: |
81+
echo "Determine the latest release version of CodeQL CLI"
82+
docker exec hostsvc-link bash -c "LATEST_RELEASE=$(curl -s https://api.github.com/repos/github/codeql-cli-binaries/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')""
83+
84+
echo "Define the download URL and target directory"
85+
docker exec hostsvc-link bash -c "DOWNLOAD_URL=\"https://github.com/github/codeql-cli-binaries/releases/download/${LATEST_RELEASE}/codeql-linux64.zip\""
86+
docker exec hostsvc-link bash -c "TARGET_DIR=\"$HOME/codeql\""
87+
docker exec hostsvc-link bash -c "ZIP_FILE=\"$TARGET_DIR/codeql.zip\""
88+
89+
echo "Create target directory if it doesn't exist"
90+
docker exec hostsvc-link bash -c "mkdir -p \"$TARGET_DIR\""
91+
92+
echo "Download the latest release of CodeQL CLI"
93+
echo "Downloading CodeQL CLI ${LATEST_RELEASE}..."
94+
docker exec hostsvc-link bash -c "curl -L \"$DOWNLOAD_URL\" -o \"$ZIP_FILE\""
95+
96+
echo "Extract the downloaded zip file"
97+
echo "Extracting CodeQL CLI..."
98+
docker exec hostsvc-link bash -c "unzip -o \"$ZIP_FILE\" -d \"$TARGET_DIR\""
99+
100+
echo "Clean up the zip file"
101+
docker exec hostsvc-link bash -c "rm \"$ZIP_FILE\""
102+
103+
echo "Optionally, add CodeQL CLI to PATH by adding it to .bashrc or .bash_profile"
104+
docker exec hostsvc-link bash -c "echo \"export PATH=\$PATH:$TARGET_DIR/codeql\" >> $HOME/.bashrc"
105+
docker exec hostsvc-link bash -c "source $HOME/.bashrc"
106+
107+
echo "CodeQL CLI installation completed."
108+
109+
- name: codeql-init
110+
shell: bash
111+
run: |
112+
docker exec hostsvc-link bash -c "codeql database create my-codeql-database --language=csharp"
113+
78114
- name: manual-build-project-service
79115
shell: bash
80116
run: |
81117
docker exec hostsvc-link bash -c "dotnet build /workspaces/hostsvc-link/src"
82118
echo "output build directory:"
83119
tree ./src/bin
84-
120+
85121
- name: manual-build-project-plugin-base
86122
shell: bash
87123
run: |
88124
docker exec hostsvc-link bash -c "dotnet build /workspaces/hostsvc-link/src_pluginBase/pluginBase.csproj"
89125
echo "output build directory:"
90126
tree ./src_pluginBase/bin
91127
128+
- name: codeql-analyze
129+
shell: bash
130+
run: |
131+
docker exec hostsvc-link bash -c "codeql database analyze my-codeql-database security-extended,security-and-quality --format=csv --output=analysis-results.csv"
132+
92133
- name: Perform CodeQL Analysis
93134
uses: github/codeql-action/analyze@v3
94135
with:

0 commit comments

Comments
 (0)