@@ -27,21 +27,44 @@ for file in $(gh pr view "$PR_NUMBER" --json files --jq '.files.[].path'); do
27
27
codeql pack create " $LANGUAGE "
28
28
29
29
# if the version of the pack is changed, comment in the PR
30
- PUBLISHED_VERSION=$( gh api /orgs/githubsecuritylab/packages/container/codeql-" $LANGUAGE " /versions --jq ' .[0].metadata.container.tags[0]' )
31
- CURRENT_VERSION=$( grep version " $LANGUAGE " /qlpack.yml | awk ' {print $2}' )
30
+ PUBLISHED_VERSION=$( gh api /orgs/githubsecuritylab/packages/container/codeql-" $LANGUAGE " -queries /versions --jq ' .[0].metadata.container.tags[0]' )
31
+ CURRENT_VERSION=$( grep version " $LANGUAGE " /src/ qlpack.yml | awk ' {print $2}' )
32
32
33
33
if [ " $PUBLISHED_VERSION " != " $CURRENT_VERSION " ]; then
34
34
echo " [+] New version of pack detected: $PUBLISHED_VERSION (pub) != $CURRENT_VERSION (cur)"
35
+ comment=" New version of pack \` githubsecuritylab/codeql-$LANGUAGE -queries\` will be created on merge: \` $PUBLISHED_VERSION \` ->\` $CURRENT_VERSION \` "
36
+ if [[ ! $( gh pr view " $PR_NUMBER " --json comments --jq ' .comments.[].body' | grep " $comment " ) ]]; then
37
+ echo " [+] Commenting on PR"
38
+ gh pr comment " $PR_NUMBER " \
39
+ --body " $comment "
40
+ fi
41
+ fi
35
42
36
- comment=" New version of pack \` githubsecuritylab/codeql-$LANGUAGE \` will be created on merge: \` $PUBLISHED_VERSION \` ->\` $CURRENT_VERSION \` "
43
+ # Same for the libs pack
44
+ PUBLISHED_VERSION=$( gh api /orgs/githubsecuritylab/packages/container/codeql-" $LANGUAGE " -libs/versions --jq ' .[0].metadata.container.tags[0]' )
45
+ CURRENT_VERSION=$( grep version " $LANGUAGE " /lib/qlpack.yml | awk ' {print $2}' )
37
46
47
+ if [ " $PUBLISHED_VERSION " != " $CURRENT_VERSION " ]; then
48
+ echo " [+] New version of pack detected: $PUBLISHED_VERSION (pub) != $CURRENT_VERSION (cur)"
49
+ comment=" New version of pack \` githubsecuritylab/codeql-$LANGUAGE -libs\` will be created on merge: \` $PUBLISHED_VERSION \` ->\` $CURRENT_VERSION \` "
38
50
if [[ ! $( gh pr view " $PR_NUMBER " --json comments --jq ' .comments.[].body' | grep " $comment " ) ]]; then
39
51
echo " [+] Commenting on PR"
40
52
gh pr comment " $PR_NUMBER " \
41
53
--body " $comment "
42
-
43
54
fi
55
+ fi
56
+ # Same for the libs extensions pack
57
+ PUBLISHED_VERSION=$( gh api /orgs/githubsecuritylab/packages/container/codeql-" $LANGUAGE " -extensions/versions --jq ' .[0].metadata.container.tags[0]' )
58
+ CURRENT_VERSION=$( grep version " $LANGUAGE " /ext/qlpack.yml | awk ' {print $2}' )
44
59
60
+ if [ " $PUBLISHED_VERSION " != " $CURRENT_VERSION " ]; then
61
+ echo " [+] New version of pack detected: $PUBLISHED_VERSION (pub) != $CURRENT_VERSION (cur)"
62
+ comment=" New version of pack \` githubsecuritylab/codeql-$LANGUAGE -extensions\` will be created on merge: \` $PUBLISHED_VERSION \` ->\` $CURRENT_VERSION \` "
63
+ if [[ ! $( gh pr view " $PR_NUMBER " --json comments --jq ' .comments.[].body' | grep " $comment " ) ]]; then
64
+ echo " [+] Commenting on PR"
65
+ gh pr comment " $PR_NUMBER " \
66
+ --body " $comment "
67
+ fi
45
68
fi
46
69
47
70
PACK_COMPILED=true
0 commit comments