Skip to content

Sync template

Sync template #196

Workflow file for this run

name: Sync template
on:
# release:
# types: [published]
workflow_dispatch:
inputs:
testpipeline:
type: boolean
description: Only run on nf-core/testpipeline?
required: true
force_pr:
description: "Force a PR to be created"
type: boolean
default: false
pipeline:
description: "Pipeline to sync"
type: string
default: "all"
debug:
description: "Enable debug/verbose mode (true or false)"
type: boolean
default: false
blog_post:
description: "link to release blogpost"
type: string
required: true
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
get-pipelines:
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event.inputs.testpipeline }}" == "true" ]; then
echo '{"pipeline":["testpipeline"]}' > pipeline_names.json
elif [ "${{ github.event.inputs.pipeline }}" != "all" ] && [ "${{ github.event.inputs.pipeline }}" != "" ]; then
curl -O https://nf-co.re/pipeline_names.json
# check if the pipeline exists
if ! grep -q "\"${{ github.event.inputs.pipeline }}\"" pipeline_names.json; then
echo "Pipeline ${{ github.event.inputs.pipeline }} does not exist"
exit 1
fi
echo '{"pipeline":["${{ github.event.inputs.pipeline }}"]}' > pipeline_names.json
else
curl -O https://nf-co.re/pipeline_names.json
fi
echo "matrix=$(cat pipeline_names.json)" >> $GITHUB_OUTPUT
sync:
needs: get-pipelines
runs-on:
- runs-on=${{ github.run_id }}-sync
- runner=4cpu-linux-x64
strategy:
matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
name: Check out nf-core/tools
with:
ref: ${{ github.ref_name }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
name: Check out nf-core/${{ matrix.pipeline }}
with:
repository: nf-core/${{ matrix.pipeline }}
ref: dev
token: ${{ secrets.nf_core_bot_auth_token }}
path: nf-core/${{ matrix.pipeline }}
fetch-depth: "0"
- name: Set up Python 3.14
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Install python dependencies
run: uv sync
- name: Install Nextflow
uses: nf-core/setup-nextflow@b4ec1bc7c16a94435159de94a05253542fddf6ef # v3
with:
version: "latest-everything"
- name: Set Git default branch from nextflow.config and set git default branch to that or "master"
run: |
pushd nf-core/${{ matrix.pipeline }}
defaultBranch=$(grep -B5 -A5 "nextflowVersion" nextflow.config | grep "defaultBranch" | cut -d"=" -f2 | sed "s/'//g")
if [ -z "$defaultBranch" ]; then
defaultBranch="master"
fi
popd
echo "Default branch: $defaultBranch"
echo "defaultBranch=$defaultBranch" >> GITHUB_OUTPUT
git config --global init.defaultBranch $defaultBranch
- name: Run synchronisation
if: github.repository == 'nf-core/tools'
env:
GITHUB_AUTH_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
run: |
git config --global user.email "core@nf-co.re"
git config --global user.name "nf-core-bot"
uv run nf-core --log-file sync_log_${{ matrix.pipeline }}.txt \
${{ github.event.inputs.debug == 'true' && '--verbose' || '' }} \
pipelines sync -d nf-core/${{ matrix.pipeline }} \
--from-branch dev \
--pull-request \
--username nf-core-bot \
--github-repository nf-core/${{ matrix.pipeline }} \
--blog-post ${{inputs.blog_post}}
- name: Upload sync log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: sync_log_${{ matrix.pipeline }}
path: sync_log_${{ matrix.pipeline }}.txt