Skip to content

test conditional linting ci #363

test conditional linting ci

test conditional linting ci #363

Workflow file for this run

name: nf-core linting
# This workflow is triggered on pushes and PRs to the repository.
# It runs the `nf-core lint` and markdown lint tests to ensure
# that the code meets the nf-core guidelines.
on:
push:
branches:
- dev
pull_request:
release:
types: [published]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Set up Python 3.12
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: "3.12"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
nf-core:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Check out pipeline code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Install Nextflow
uses: nf-core/setup-nextflow@v2
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: "3.12"
architecture: "x64"
- name: read .nf-core.yml
uses: pietrobolcato/action-read-yaml@1.0.0
id: read_yml
with:
config: ${{ github.workspace }}/.nf-core.yml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nf-core==${{ steps.read_yml.outputs['nf_core_version'] }}
- name: Check nf-core outdated
id: nf_core_outdated
run: pip list --outdated | grep nf-core
- name: Post nf-core last version comment
uses: actions/github-script@v6
if: ${{ steps.nf_core_outdated.outputs.stdout }} =~ 'nf-core'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: |
## :warning: New nf-core template version available
Your pipeline is using an old version of the nf-core template: ${{ steps.read_yml.outputs['nf_core_version'] }}.
Please update your pipeline to the latest version.
})
- name: Run nf-core lint
env:
GITHUB_COMMENTS_URL: ${{ github.event.pull_request.comments_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_COMMIT: ${{ github.event.pull_request.head.sha }}
run: nf-core -l lint_log.txt lint --dir ${GITHUB_WORKSPACE} --markdown lint_results.md
- name: Save PR number
if: ${{ always() }}
run: echo ${{ github.event.pull_request.number }} > PR_number.txt
- name: Upload linting log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: linting-logs
path: |
lint_log.txt
lint_results.md
PR_number.txt