Skip to content

Commit dcc9c49

Browse files
authored
Refactor CodeQL packs handling in workflow
1 parent a41cbab commit dcc9c49

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/codeql-packs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ jobs:
1818
- name: "Set Matrix"
1919
id: set-matrix
2020
uses: actions/github-script@v8
21+
env:
22+
INPUTS_PACKS: ${{ inputs.packs }}
2123
with:
2224
script: |
23-
const packs = '${{ inputs.packs }}'.split(',');
25+
const packs = process.env.INPUTS_PACKS.split(',');
2426
packs.forEach((pack, index) => {
2527
if (pack.endsWith('qlpack.yml')) {
2628
packs[index] = pack.slice(0, -10);
@@ -48,19 +50,18 @@ jobs:
4850
env:
4951
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5052
PACKS: ${{ matrix.packs }}
53+
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
5154
run: |
5255
PACK_PATH="${PACKS}/qlpack.yml"
5356
CURRENT_VERSION=$(grep version $PACK_PATH | awk '{print $2}')
5457
PACK_FULLNAME=$(cat $PACK_PATH | grep "name:" | awk '{print $2}')
5558
PACK_NAME=$(echo $PACK_FULLNAME | awk -F '/' '{print $2}')
5659
57-
PUBLISHED_VERSION=$(gh api /orgs/${{ github.repository_owner }}/packages/container/$PACK_NAME/versions --jq '.[0].metadata.container.tags[0]')
60+
PUBLISHED_VERSION=$(gh api /orgs/"$GITHUB_REPOSITORY_OWNER"/packages/container/"$PACK_NAME"/versions --jq '.[0].metadata.container.tags[0]')
5861
echo "Packs :: ${CURRENT_VERSION} -> ${PUBLISHED_VERSION}"
5962
6063
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
6164
gh extension install github/gh-codeql
6265
gh codeql pack install "${{ matrix.packs }}"
6366
gh codeql pack publish "${{ matrix.packs }}"
6467
fi
65-
66-

0 commit comments

Comments
 (0)