update-barcodes #7
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: 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/gp201/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/gp201/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/gp201/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/gp201/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 | |