Skip to content

fix if clause

fix if clause #2

Workflow file for this run

name: Clone and Upload to S3

Check failure on line 1 in .github/workflows/backups.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/backups.yml

Invalid workflow file

`schedule` accepts a list of one or more maps with the `cron` key set
on:
schedule:
# Runs at 00:00 UTC every Sunday
# - cron: '0 0 * * 0' # TODO: Uncomment this after testing
workflow_dispatch:
inputs:
pipeline:
description: 'Pipeline to backup'
required: true
default: 'all'
jobs:
get-pipelines:
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
matrix=$(curl https://nf-co.re/pipeline_names.json)
if [ -n "${{ inputs.pipeline }}" ] && [ "${{ inputs.pipeline }}" != "all" ]; then
matrix=$(echo $matrix | jq --arg pipeline "${{ inputs.pipeline }}" '[.[] | select(.name == $pipeline)]')
fi
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
backup:
needs: get-pipelines
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}}
fail-fast: false
env:
TARBALL_FILENAME: ${{ matrix.pipeline }}_$(date +%Y-%m-%d_%H-%M).tar.gz
steps:
- name: Clone the repository
run: git clone --mirror https://github.com/nf-core/${{ matrix.pipeline }}.git
- name: Make a tarball
run: tar czf $TARBALL_FILENAME ${{ matrix.pipeline }}.git
- name: setup aws cli
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_BACKUP_ROLE }}
aws-region: eu-west-1
- name: Upload repository to S3
run: |
aws s3 cp $TARBALL_FILENAME s3express://nf-core-repos-backup--euw1-az1--x-s3/$TARBALL_FILENAME