Sync template #46
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: Sync template | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
testpipeline: | |
type: boolean | |
description: Only run on nf-core/testpipeline? | |
required: true | |
runners: | |
description: "Runners to test on" | |
type: choice | |
options: | |
- "ubuntu-latest" | |
- "self-hosted" | |
default: "self-hosted" | |
# 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 | |
else | |
curl -O https://nf-co.re/pipeline_names.json | |
fi | |
echo "matrix=$(cat pipeline_names.json)" >> $GITHUB_OUTPUT | |
sync: | |
needs: get-pipelines | |
# use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default | |
runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} | |
strategy: | |
matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
name: Check out nf-core/tools | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
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.11 | |
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 | |
with: | |
python-version: 3.11 | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Install Nextflow | |
uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 | |
with: | |
version: "latest-everything" | |
- 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 "[email protected]" | |
git config --global user.name "nf-core-bot" | |
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt sync -d nf-core/${{ matrix.pipeline }} \ | |
--from-branch dev \ | |
--pull-request \ | |
--username nf-core-bot \ | |
--github-repository nf-core/${{ matrix.pipeline }} | |
- name: Upload sync log file artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 | |
with: | |
name: sync_log_${{ matrix.pipeline }} | |
path: sync_log_${{ matrix.pipeline }}.txt |