-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (56 loc) · 2.12 KB
/
automatic.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Automatic CSV PR
on:
schedule:
- cron: '0 15 * * 6'
workflow_dispatch:
jobs:
update-csv:
runs-on: macos-14
steps:
- id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download new CSV
run: |
if curl -o "Raw Data/faa_ai_prelim ${{ steps.date.outputs.date }}.csv" https://www.asias.faa.gov/apex/f?p=100:93::FLOW_EXCEL_OUTPUT_R16070756597770675_en; then
echo "CSV download successful."
else
echo "CSV download failed."
exit 1
fi
- name: Check CSV file size
id: check-csv
run: |
if [ -s "Raw Data/faa_ai_prelim ${{ steps.date.outputs.date }}.csv" ]; then
echo "CSV file is not empty."
else
echo "CSV file is empty."
exit 1
fi
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- run: pip install -r "Raw Data/requirements.txt"
- name: Run Python script
working-directory: "Raw Data"
run: |
python csv_merge.py
- name: Commit and Push Changes
if: steps.check-csv.outcome == 'success'
run: |
git config --global user.name "Aaron Raimist" # "GitHub Actions"
git config --global user.email "[email protected]" # "[email protected]"
branch_name='${{ steps.date.outputs.date }}-update'
git checkout -b "$branch_name"
git add "Raw Data/faa_ai_prelim ${{ steps.date.outputs.date }}.csv"
git add "FAA-Accident-Incident-Data.csv"
git commit -m '${{ steps.date.outputs.date }} Update' -m "Automatically created with GitHub Actions."
git push origin "$branch_name"
- name: create pull request
run: gh pr create -B main -H '${{ steps.date.outputs.date }}-update' --title '${{ steps.date.outputs.date }} Update' --body 'Automatically created with GitHub Actions.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}