Skip to content

Commit e353290

Browse files
authored
Merge pull request #13 from advanced-security/fix-script-reference
Fix script reference
2 parents 8247381 + 7091fa5 commit e353290

File tree

5 files changed

+72
-72
lines changed

5 files changed

+72
-72
lines changed

.github/workflows/test-create-bundle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
name: "Create custom bundle"
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
1110
- uses: advanced-security/codeql-bundle-action/download-bundle@v2
1211
id: download-bundle
1312
with:
1413
tag: "latest"
1514
platforms: "osx64,linux64,win64"
15+
- uses: actions/checkout@v4
1616
- uses: advanced-security/codeql-bundle-action/create-bundle@v2
1717
id: create-bundle
1818
with:
@@ -22,7 +22,7 @@ jobs:
2222
default-code-scanning-config: "${{ github.workspace }}/tests/code-scanning-config.yml"
2323
platforms: "osx64,linux64,win64"
2424
debug: "true"
25-
- uses: actions/upload-artifact@v3
25+
- uses: actions/upload-artifact@v4
2626
with:
2727
name: codeql-bundles
2828
path: ${{ steps.create-bundle.outputs.output-path }}

create-bundle/action.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ runs:
3939
python -m pip install https://github.com/rvermeulen/codeql-bundle/releases/download/v0.2.0/codeql_bundle-0.2.0-py3-none-any.whl
4040
echo "::endgroup::"
4141
shell: bash
42-
- run: create-bundle/create-bundle.sh
43-
id: create-bundle
42+
- id: create-bundle
4443
env:
4544
BUNDLE_PATH: ${{ inputs.bundle-path }}
4645
PACKS: ${{ inputs.packs }}
@@ -49,4 +48,40 @@ runs:
4948
PLATFORMS: ${{ inputs.platforms }}
5049
RUNNER_TEMP: ${{ runner.temp }}
5150
DEBUG: ${{ inputs.debug }}
52-
shell: bash
51+
shell: bash
52+
run: |
53+
#!/bin/bash
54+
55+
set -e
56+
57+
echo "::group::Creating CodeQL bundle."
58+
echo "Using bundle at ${BUNDLE_PATH}."
59+
echo "Using workspace at ${WORKSPACE}."
60+
output_path=${RUNNER_TEMP}/codeql-bundle.tar.gz
61+
opts=()
62+
opts+=("--bundle" "${BUNDLE_PATH}")
63+
opts+=("--workspace" "${WORKSPACE}")
64+
if [[ -n ${PLATFORMS} ]]; then
65+
echo "Targetting the platforms ${PLATFORMS}."
66+
for platform in $(echo $PLATFORMS | tr ',' ' '); do
67+
opts+=("--platform" "${platform}")
68+
done
69+
# When building multiple bundles, the output path is the directory containing the bundles
70+
output_path=${RUNNER_TEMP}/bundles
71+
mkdir -p ${output_path}
72+
fi
73+
opts+=("--output" "${output_path}")
74+
if [[ -n ${DEFAULT_CODE_SCANNING_CONFIG} ]]; then
75+
echo "Using code scanning config at ${DEFAULT_CODE_SCANNING_CONFIG} as the default config."
76+
opts+=("--code-scanning-config" "${DEFAULT_CODE_SCANNING_CONFIG}")
77+
fi
78+
79+
if [[ ${DEBUG} -eq "true" ]]; then
80+
opts+=("--log DEBUG")
81+
fi
82+
83+
84+
codeql-bundle ${opts[@]} $(echo ${PACKS} | tr ',' ' ')
85+
echo "::endgroup::"
86+
87+
echo "output-path=${output_path}" >> $GITHUB_OUTPUT

create-bundle/create-bundle.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

download-bundle/action.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,40 @@ outputs:
2020
runs:
2121
using: "composite"
2222
steps:
23-
- run: download-bundle/download-bundle.sh
23+
- id: download-bundle
2424
shell: bash
25-
id: download-bundle
2625
env:
2726
TAG: ${{ inputs.tag }}
2827
PLATFORMS: ${{ inputs.platforms }}
2928
RUNNER_TEMP: ${{ runner.temp }}
30-
GH_TOKEN: ${{ inputs.token }}
29+
GH_TOKEN: ${{ inputs.token }}
30+
run: |
31+
#!/bin/bash
32+
33+
set -e
34+
35+
output_path=${RUNNER_TEMP}/codeql-bundle.tar.gz
36+
platforms=()
37+
if [[ -n ${PLATFORMS} ]]; then
38+
for platform in $(echo $PLATFORMS | tr ',' ' '); do
39+
platforms+=("${platform}")
40+
done
41+
fi
42+
43+
if [[ ${TAG} -ne "latest" ]]; then
44+
opts+=("${TAG}")
45+
fi
46+
47+
if [[ ${#platforms[@]} -eq 1 ]]; then
48+
opts+=("--pattern codeql-bundle-${platforms[0]}.tar.gz")
49+
else
50+
opts+=("--pattern codeql-bundle.tar.gz")
51+
fi
52+
53+
opts+=("--output ${output_path}")
54+
55+
echo "::group::Downloading CodeQL bundle"
56+
gh release download --repo github/codeql-action ${opts[@]}
57+
echo "::endgroup::"
58+
59+
echo "bundle-path=${output_path}" >> $GITHUB_OUTPUT

download-bundle/download-bundle.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)