-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* docs: add caching for CVE data * docs: modify folders * docs: clean up comments * chore: add additional try catch * docs: test with error * docs: remove error for new test * docs: modify unpack and add error back * ci: auto-formatting prettier issues * docs: add success status filter * chore: add status filter * docs: fix command error * docs: remove test error * docs: remove test error * docs: add filter to packs * docs: modify one more error code * docs: add to readme * test with dummy dso value * docs: change dso token back --------- Co-authored-by: lennessyy <[email protected]> (cherry picked from commit 472d925) Co-authored-by: Lenny Chen <[email protected]>
- Loading branch information
1 parent
b95de7e
commit 3cd0b0f
Showing
16 changed files
with
229 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "Build with cached CVEs" | ||
inputs: | ||
gh-token: | ||
description: "GitHub Token for authentication" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install jq (JSON processor) if not found | ||
run: | | ||
if ! command -v jq &> /dev/null; then | ||
sudo apt-get update | ||
sudo apt-get install -y jq | ||
else | ||
echo "jq is already installed. Skipping install..." | ||
fi | ||
shell: bash | ||
|
||
- name: Download CVE Data | ||
run: | | ||
# Find the latest CVE upload workflow. | ||
run_id=$(gh run list --workflow="post_release.yaml" --limit 1 --status=success --json databaseId | jq -r '.[0].databaseId') | ||
echo 'Fetching artifacts from run $run_id' | ||
# Remove any downloaded artifacts, should they exist. | ||
rm -rf ./downloaded_artifacts | ||
# Download the latest artifact to a new dir. | ||
gh run download ${run_id} --name security-bulletins --dir ./downloaded_artifacts | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ inputs.gh-token }} | ||
|
||
- name: Unpack CVE data | ||
run: | | ||
# Ensure the correct folders exist. | ||
mkdir -p .docusaurus/security-bulletins/default | ||
# Move the files to their correct places in the checked out repository | ||
mv downloaded_artifacts/data.json .docusaurus/security-bulletins/default/data.json | ||
rm -rf downloaded_artifacts | ||
shell: bash | ||
|
||
- name: Build | ||
run: | | ||
rm -rf build | ||
npm run build | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
|
||
# Enable error handling | ||
set -e | ||
|
||
echo "Starting fetch of cached cves..." | ||
|
||
if command -v gh &> /dev/null | ||
then | ||
echo "✅ GitHub CLI is installed." | ||
else | ||
echo "❌ GitHub CLI is not installed." | ||
echo "ℹ️ Use 'brew install gh' to install it with Homebrew." | ||
exit 1 | ||
fi | ||
|
||
if gh auth status &> /dev/null | ||
then | ||
echo "✅ GitHub CLI is authenticated. " | ||
else | ||
echo "❌ GitHub CLI is not authenticated." | ||
echo "ℹ️ Please log in with 'gh auth login'." | ||
exit 1 | ||
fi | ||
# Find the latest cves upload workflow. | ||
|
||
run_id=$(gh run list --workflow="post_release.yaml" --status=success --limit 1 --json databaseId | jq -r '.[0].databaseId') | ||
|
||
# Remove any downloaded artifacts, should they exist. | ||
rm -rf ./downloaded_artifacts | ||
|
||
# Download the latest artifact to a new dir. | ||
gh run download ${run_id} --name security-bulletins --dir ./downloaded_artifacts | ||
echo "✅ Cached CVEs artifact downloaded." | ||
|
||
# Ensure the correct folders exist. | ||
mkdir -p .docusaurus/security-bulletins/default | ||
|
||
# Move the files to their correct places in the checked out repository | ||
mv downloaded_artifacts/data.json .docusaurus/security-bulletins/default/data.json | ||
|
||
# Clean up. | ||
rm -rf downloaded_artifacts | ||
|
||
echo "✅ Completed fetch of cached CVEs." | ||
echo "⏭️ You can now execute 'make start' or 'make build'." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters