Scheduled Import for All Projects #217
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: Scheduled Import for All Projects | |
on: | |
schedule: | |
- cron: "0 */6 * * *" | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Install Cargo Lambda with pip3 | |
run: | | |
pip3 install cargo-lambda | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Loop through all JSON files in data/projects | |
run: | | |
for file in data/projects/*.json; do | |
# Echo out the current file name | |
echo "About to process file: $file" | |
FILE_NAME=$(basename "$file") | |
echo "Base file name: $FILE_NAME" | |
cargo run -p generate_import_payload -- $file | |
cd src/import | |
cargo lambda invoke --remote gh-import-issues --region us-east-1 --data-file payloads/$FILE_NAME | |
# Return to the root directory | |
cd - | |
done | |
- name: Revalidate caches | |
run: | | |
echo "Revalidating cache for latest issues" | |
curl --request POST "${{ vars.REVALIDATE_CACHE_URL }}/latest-issues" \ | |
--header "${{ secrets.AUTH_HEADER }}" |