Skip to content

Commit

Permalink
Merge pull request #973 from the-commons-project/audit-failures
Browse files Browse the repository at this point in the history
Audit failures
  • Loading branch information
TCPopsadmin authored Sep 24, 2024
2 parents f2e2ab9 + f2dcec5 commit ed11ea3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-scripts-pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
- 'vci-issuers*.json'
- 'scripts/*.py'
- '.github/workflows/test-scripts.yaml'
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
runTests:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/validate-issuers-on-push-pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
- 'vci-issuers*.json'
- 'scripts/*.py'
- '.github/workflows/validate-issuers.yaml'
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
runTests:
Expand Down
36 changes: 34 additions & 2 deletions .github/workflows/vci-directory-audit.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Nightly audit

on:
schedule:
- cron: '30 4 * * *'
- cron: '30 4 * * *'
workflow_dispatch:
push:
tags:
- audit*

jobs:
vci-directory-audit:
runs-on: ubuntu-latest
Expand All @@ -14,20 +16,24 @@ jobs:
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v2
with:
node-version: '14'

- name: npm setup
run: |
cd scripts/vci-directory-auditor
npm install
npm run build --if-present
- name: run audit scripts
run: |
cd scripts/vci-directory-auditor
npm run audit -- -o ../../logs/new_log.json -p ../../logs/daily_log.json -s ../../logs/daily_log_snapshot.json -a ../../logs/daily_audit.json -d ../../vci-issuers.json
mv ../../logs/new_log.json ../../logs/daily_log.json
npm run assemble -- -s ../../logs/vci_snapshot.json -c ../../logs/daily_log_snapshot.json
- name: sign snapshot
env:
PRIVATE_SIG_KEY_PWD: ${{ secrets.PRIVATE_SIG_KEY_PWD }}
Expand All @@ -36,6 +42,31 @@ jobs:
echo "$PRIVATE_SIG_KEY" > private.pem
openssl dgst -sha512 -sign private.pem -out logs/vci_snapshot.sig -passin env:PRIVATE_SIG_KEY_PWD logs/vci_snapshot.json
rm private.pem
test-scripts-job:
needs: vci-directory-audit
uses: the-commons-project/vci-directory/.github/workflows/test-scripts-pass.yaml@main
with:
ref: main
secrets: inherit

validate-issuers-job:
needs: test-scripts-job
uses: the-commons-project/vci-directory/.github/workflows/validate-issuers-on-push-pass.yaml@main
with:
ref: main
secrets: inherit

git-push-job:
needs: [vci-directory-audit, test-scripts-job, validate-issuers-job]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: git check in
env:
GIT_OWNER_EMAIL: ${{ secrets.GIT_OWNER_EMAIL }}
Expand All @@ -59,10 +90,11 @@ jobs:
git commit -a -m "added commit hash to audit index"
git remote add myorigin https://$GIT_OWNER_NAME:[email protected]/$GIT_REPO_PATH/vci-directory.git
git pull --rebase
git push myorigin HEAD:main --force
git push myorigin HEAD:main
else
echo 'no changes'
fi
- name: save log files
uses: actions/upload-artifact@v4
with:
Expand Down

0 comments on commit ed11ea3

Please sign in to comment.