Skip to content

Scheduled Run

Scheduled Run #42

name: Process Flu SRA (self-hosted)
run-name: ${{ github.event.inputs.reason || 'Scheduled Run' }}
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
reason:
description: 'Reason for running the workflow'
required: true
default: 'Routine Processing'
testing:
type: boolean
description: 'Run in testing mode'
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 }}
FLUSRA_VERSION: 'main'
BIOPROJECTS: "PRJNA1102327,PRJNA1122849,PRJNA1134696"
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
TOWER_WORKSPACE_ID: ${{ secrets.TOWER_WORKSPACE_ID }}
defaults:
run:
shell: bash -eli {0}
jobs:
process_sra:
runs-on: self-hosted
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/install-dependencies
- name: Run nextflow
run: nextflow run https://github.com/gp201/flusra.git -r ${{ env.FLUSRA_VERSION }} -c ${{ github.workspace }}/config/nextflow.config -profile mamba --bioproject ${{ env.BIOPROJECTS }} --outdir ${{ env.NXF_OUTPUT }} -name ${{ env.NXF_NAME }} -with-tower -latest
- name: Push outputs
if: ${{ hashFiles('outputs/metadata/*.tsv') != '' }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
mv ${{ env.NXF_OUTPUT }}/metadata/SraRunTable_automated_updated.csv ${{ github.workspace }}/metadata/SraRunTable_automated.csv
mv ${{ env.NXF_OUTPUT }}/fasta/*.fa ${{ github.workspace }}/fasta/
mv ${{ env.NXF_OUTPUT }}/depth/*.tsv ${{ github.workspace }}/depth/
mv ${{ env.NXF_OUTPUT }}/variants/*.tsv ${{ github.workspace }}/variants/
if [ -d ${{ env.NXF_OUTPUT }}/demixed/ ]; then
mv ${{ env.NXF_OUTPUT }}/demixed/* ${{ github.workspace }}/demixed/
git add ${{ github.workspace }}/demixed/
fi
git add ${{ github.workspace }}/metadata/SraRunTable_automated.csv
git add ${{ github.workspace }}/fasta/
git add ${{ github.workspace }}/depth/
git add ${{ github.workspace }}/variants/
git commit -m "Add consensus sequences, depth, variant files, demixed files and updated metadata"
- name: Push to GitHub
if: ${{ github.event.inputs.testing != 'true' || github.event_name == 'schedule' }}
run: git push
- name: Generate Run Summary
if: ${{ hashFiles('outputs/metadata/*.tsv') != '' }}
run: |
echo "# Job Summary $(date)" >> $GITHUB_STEP_SUMMARY
echo "## Job Information" >> $GITHUB_STEP_SUMMARY
samples=$(awk -F'\t' '$2 == "True" { print $1 }' outputs/metadata/*_to_process.tsv)
milk=$(awk -F"\t" '$3 == "True" { print $1 }' outputs/metadata/*_to_process.tsv)
echo "<details><summary>Processed $(echo "$samples" | wc -l) samples</summary>" >> $GITHUB_STEP_SUMMARY
printf '%s\n' "$samples" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "<details><summary>Processed $(echo "$milk" | wc -l) milk samples</summary>" >> $GITHUB_STEP_SUMMARY
printf '%s\n' "$milk" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Workflow diagram" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`mermaid" >> $GITHUB_STEP_SUMMARY
cat outputs/pipeline_info/*.mmd >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Upload Nextflow log
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-run-log
include-hidden-files: true
path: ${{ github.workspace }}/.nextflow.log
- name: Clean Nextflow Run
if: success()
run: nextflow clean $NXF_NAME -f