Skip to content

nf-core pipeline lint gives cryptic prettier error message #1329

nf-core pipeline lint gives cryptic prettier error message

nf-core pipeline lint gives cryptic prettier error message #1329

Workflow file for this run

name: Update CHANGELOG.md
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened]
branches:
- dev
jobs:
update_changelog:
runs-on: ubuntu-latest
# Run if comment is on a PR with the main repo, and if it contains the magic keywords.
# Or run on PR creation, unless asked otherwise in the title.
if: |
github.repository_owner == 'nf-core' && (
github.event_name == 'pull_request_target' ||
github.event.issue.pull_request && startsWith(github.event.comment.body, '@nf-core-bot changelog')
)
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
token: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
# Action runs on the issue comment, so we don't get the PR by default.
# Use the GitHub CLI to check out the PR:
- name: Checkout Pull Request
env:
GH_TOKEN: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
run: |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
PR_NUMBER="${{ github.event.issue.number }}"
elif [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
fi
gh pr checkout $PR_NUMBER
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: "3.12"
- name: Install packages
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Update CHANGELOG.md from the PR title
env:
COMMENT: ${{ github.event.comment.body }}
GH_TOKEN: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
run: |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
export PR_NUMBER='${{ github.event.issue.number }}'
export PR_TITLE='${{ github.event.issue.title }}'
elif [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
export PR_NUMBER='${{ github.event.pull_request.number }}'
export PR_TITLE='${{ github.event.pull_request.title }}'
fi
python ${GITHUB_WORKSPACE}/.github/workflows/changelog.py
- name: Check if CHANGELOG.md actually changed
run: |
git diff --exit-code ${GITHUB_WORKSPACE}/CHANGELOG.md || echo "changed=YES" >> $GITHUB_ENV
echo "File changed: ${{ env.changed }}"
- name: Set up Python 3.12
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: "3.12"
cache: "pip"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit checks
if: env.changed == 'YES'
run: |
pre-commit run --all-files
- name: Commit and push changes
if: env.changed == 'YES'
run: |
git config user.email "core@nf-co.re"
git config user.name "nf-core-bot"
git config push.default upstream
git add ${GITHUB_WORKSPACE}/CHANGELOG.md
git status
git commit -m "[automated] Update CHANGELOG.md"
git push