Skip to content

added entries

added entries #29

Workflow file for this run

name: Convert .toml to json
on:
push:
branches:
- main
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
- name: Install Dependencies
run: npm install toml
- name: Prepend current timestamp to filename and commit it
run: |
folder_path="entries"
current_timestamp=$(date +"%s")
files=$(ls "$folder_path")
has_changed=false
for file in $files; do
if [[ ! $file =~ ^[0-9]+_ ]]; then
new_filename="${current_timestamp}_${file}"
mv "${folder_path}/${file}" "${folder_path}/${new_filename}"
echo "Prepended timestamp to: ${file} --> ${new_filename}"
has_changed=true
fi
done
if [ "$has_changed" = true ]; then
git config --global user.email "no-reply@github.com"
git config --global user.name "GitHub Actions"
git add .
git commit -m "Added entries"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Script for Each File
run: node toml2json.js | tee src/output.json
- name: Upload to S3
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Upload Results to S3
run: aws s3 cp src/output.json s3://weaponize/