Update NCBI metadata #316
This file contains hidden or 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: Update NCBI metadata | |
on: | |
schedule: | |
- cron: '0 0 */7 * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.repository }} | |
env: | |
NXF_VER: "24.10.4" | |
NXF_WORK: ${{ github.workspace }}/work | |
NXF_OUTPUT: ${{ github.workspace }}/outputs | |
NXF_NAME: github-${{ github.run_number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
defaults: | |
run: | |
shell: bash -eli {0} | |
jobs: | |
fetch_ncbi_metadata: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache envs | |
id: cache-envs | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.NXF_WORK }}/conda | |
$CONDA_PREFIX/envs | |
key: env-${{ env.NXF_VER }}-${{ github.job }} | |
restore-keys: | | |
env-${{ env.NXF_VER }}-${{ github.job }} | |
env-${{ env.NXF_VER }} | |
env- | |
- name: 'Check and setup conda environment' | |
run: | | |
mamba env update --name freyja-sra --file environment.yml --prune | |
- name: Fetch NCBI metadata | |
run: | | |
mamba activate freyja-sra | |
python scripts/fetch_sra_metadata.py | |
- name: 'Get updated barcodes and lineages from Freyja repo' | |
run: | | |
git clone http://github.com/andersen-lab/Freyja | |
cp Freyja/freyja/data/usher_barcodes.feather data/ | |
cp Freyja/freyja/data/lineages.yml data/ | |
cp Freyja/freyja/data/last_barcode_update.txt data/ | |
- name: 'Commit and push changes' | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git remote set-url origin https://github.com/andersen-lab/Freyja-SRA | |
if [[($(git status data/usher_barcodes.feather --porcelain | wc -c) -ne 0)]]; then | |
git add data/usher_barcodes.feather | |
git add data/lineages.yml | |
git add data/last_barcode_update.txt | |
fi | |
git add data/all_metadata.csv | |
git commit -m "Update metadata" | |
git push --force |