-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (43 loc) · 2.1 KB
/
pull.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
name: Get pathogen barcodes
on:
repository_dispatch:
types: [update-barcodes]
workflow_dispatch:
inputs:
pathogen:
description: 'Pathogen name'
required: true
jobs:
get_pathogen_barcodes:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3.3.0
- name: Get pathogen barcodes
env:
PATHOGEN: ${{ github.event.client_payload.pathogen || github.event.inputs.pathogen }}
run: |
echo "Pathogen: $PATHOGEN"
# check if folder named pathogen exists
if [ ! -d "$PATHOGEN" ]; then
echo "Pathogen $PATHOGEN does not exist"
else
cd $PATHOGEN
# make directory with current date
date=$(date +%Y-%m-%d)
mkdir $date
# download pathogen barcodes
wget -O $date/barcode.csv https://raw.githubusercontent.com/andersen-lab/Freyja-process-barcodes/main/${{ env.PATHOGEN }}/output/GENERATE_BARCODES/barcode.csv --header 'Authorization: token ${{ secrets.FREYJA_ACTION_KEY }}'
wget -O $date/barcode.html https://raw.githubusercontent.com/andersen-lab/Freyja-process-barcodes/main/${{ env.PATHOGEN }}/output/GENERATE_BARCODES/barcode.html --header 'Authorization: token ${{ secrets.FREYJA_ACTION_KEY }}'
wget -O $date/auspice_tree.json https://raw.githubusercontent.com/andersen-lab/Freyja-process-barcodes/main/${{ env.PATHOGEN }}/data/auspice_tree.json --header 'Authorization: token ${{ secrets.FREYJA_ACTION_KEY }}'
wget -O $date/reference.fasta https://raw.githubusercontent.com/andersen-lab/Freyja-process-barcodes/main/${{ env.PATHOGEN }}/data/reference.fasta --header 'Authorization: token ${{ secrets.FREYJA_ACTION_KEY }}'
# commit and push
git pull origin main
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add $date
git commit -m "Add pathogen barcodes for $PATHOGEN"
git push
fi