Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,5 @@
"depNameTemplate": "aquasecurity/trivy",
"versioningTemplate": "semver"
},
// enry version in setup enry step
{
"customType": "regex",
"managerFilePatterns": [
"/^.github/workflows/supply-chain-security-validation.yaml$/"
],
"matchStrings": ["ENRY_VERSION:\\s*(?<currentValue>v[0-9.]+)"],
"datasourceTemplate": "github-releases",
"depNameTemplate": "go-enry/enry",
"versioningTemplate": "semver"
},
],
}
42 changes: 20 additions & 22 deletions .github/workflows/supply-chain-security-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,45 +83,43 @@ jobs:
uses: actions/checkout@v6
- name: Configure access to internal and private GitHub repos
run: git config --global url."https://${{ secrets.REVIEWBOT_GITHUB_TOKEN }}:x-oauth-basic@github.com/coopnorge".insteadOf "https://github.com/coopnorge"
- name: Setup enry
env:
ENRY_VERSION: v1.2.0
run: |
set -euo pipefail

curl -L -o "$RUNNER_TEMP/enry.tar.gz" "https://github.com/go-enry/enry/releases/download/$ENRY_VERSION/enry-$ENRY_VERSION-linux-amd64.tar.gz"
tar -xzf "$RUNNER_TEMP/enry.tar.gz" -C "$RUNNER_TEMP"

mkdir -p $HOME/.local/bin
mv "$RUNNER_TEMP/enry" "$HOME/.local/bin/"

chmod +x "$HOME/.local/bin/enry"

echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v6
with:
repository: coopnorge/github-workflow-supply-chain-security-validation
sparse-checkout: |
docker-compose.yaml
path: .tmp-github-workflow-supply-chain-security-validation
- name: Detected Languages
id: detected-languages
run: echo "languages=$(enry | awk -F ' ' '{print $2}' | paste -sd ',' -)" >> $GITHUB_OUTPUT
run: |
set -euo pipefail
DOCKER_COMPOSE_PATH=$(mktemp ./docker-compose.XXXXXXXXXX.yaml)
mv ".tmp-github-workflow-supply-chain-security-validation/docker-compose.yaml" "$DOCKER_COMPOSE_PATH"
export USER_ID=$(id -u) && export GROUP_ID=$(id -g)
echo "languages=$(docker compose -f $DOCKER_COMPOSE_PATH run --rm linguist | awk '{print $3}' | paste -sd ',' -)" >> $GITHUB_OUTPUT
rm "$DOCKER_COMPOSE_PATH"
rm -rf ".tmp-github-workflow-supply-chain-security-validation"
- uses: actions/github-script@v8
name: Get CodeQL supported languages
id: languages
with:
result-encoding: json
script: |
const enryCodeQLMapping = {
const linguistCodeQLMapping = {
'c#': 'csharp',
};
function getCodeQLLanguage(enryLang) {
if (enryLang in enryCodeQLMapping) {
return enryCodeQLMapping[enryLang];
function getCodeQLLanguage(linguistLang) {
if (linguistLang in linguistCodeQLMapping) {
return linguistCodeQLMapping[linguistLang];
}
return enryLang;
return linguistLang;
}
const detectedLanguages = '${{ steps.detected-languages.outputs.languages }}'.toLowerCase().split(',').map(language => {
return getCodeQLLanguage(language)
});

// Always scan for actions
// Enry does not find GitHub actions and they always exist if this workflow is running
// linguist does not find GitHub actions and they always exist if this workflow is running
// So, always add it.
detectedLanguages.push('actions');

Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
linguist:
image: ghcr.io/github-linguist/linguist:v9.5.0@sha256:24d32762687af71000f2a7ccbd3eb567519b022025578b339d33c97982d82ec6
working_dir: /src
user: "${USER_ID}:${GROUP_ID}"
environment:
- GIT_CONFIG_GLOBAL=/tmp/.gitconfig
volumes:
- .:/src:ro,z