VCI directory audit action #880
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
name: VCI directory audit action | |
on: | |
schedule: | |
- cron: '0 12 * * *' | |
jobs: | |
vci-directory-audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- run: | | |
npm install | |
npm run build --if-present | |
- run: | | |
npm run audit -- -o logs/latest_dir.json -p logs/daily_dir_snapshot.json -a logs/audit.json | |
mv logs/audit.json logs/daily_audit.json | |
mv logs/latest_dir.json logs/daily_dir_snapshot.json | |
- name: git check in | |
env: | |
GIT_OWNER_EMAIL: ${{ secrets.GIT_OWNER_EMAIL }} | |
PUSH_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
run: | | |
git config user.email "$GIT_OWNER_EMAIL" | |
git config user.name "christianpaquin" | |
if [[ `git status --porcelain` ]]; then | |
git add -f logs/daily_audit.json | |
git add -f logs/daily_dir_snapshot.json | |
git commit -a -m "daily dir and audit snapshot" | |
git remote add myorigin https://christianpaquin:$PUSH_TOKEN@github.com/christianpaquin/vci-directory-auditor.git | |
git push myorigin HEAD:main | |
else | |
echo 'no changes' | |
fi | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: save-log-files | |
path: logs/* | |