Skip to content

Add --help-json flag for machine-readable CLI help #2204

Add --help-json flag for machine-readable CLI help

Add --help-json flag for machine-readable CLI help #2204

name: Update Textual snapshots from a comment
on:
issue_comment:
types: [created] # Add "@nf-core-bot update textual snapshots" as a PR comment to trigger this workflow.
jobs:
update-snapshots:
runs-on: ubuntu-latest
steps:
- name: branch-deploy
id: branch-deploy
uses: github/branch-deploy@fded0351b6b79f854b335c11b3d93063461dd288 # v11.1.2
with:
trigger: "@nf-core-bot update textual snapshots"
reaction: "eyes"
stable_branch: "dev"
# Use the @nf-core-bot token to check out so we can push later
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
token: ${{ secrets.nf_core_bot_auth_token }}
# indication that the command is running
- name: React on comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
comment-id: ${{ github.event.comment.id }}
reactions: eyes
# Action runs on the issue comment, so we don't get the PR by default
# Use the gh cli to check out the PR
- name: Checkout Pull Request
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
# Install dependencies and run pytest
- name: Set up Python
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 dependencies
run: uv sync --all-extras
- name: Run pytest to update snapshots
id: pytest
run: |
uv run python -m pytest tests/pipelines/test_create_app.py --snapshot-update --color=yes --durations=0 -n auto
continue-on-error: true
# indication that the run has finished
- name: react if finished succesfully
if: steps.pytest.outcome == 'success'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
comment-id: ${{ github.event.comment.id }}
reactions: "+1"
- name: Commit & push changes
id: commit-and-push
if: steps.pytest.outcome == 'success'
run: |
git config user.email "core@nf-co.re"
git config user.name "nf-core-bot"
git config push.default upstream
git add .
git status
git commit -m "[automated] Update Textual snapshots"
git push
- name: react if snapshots were updated
id: react-if-updated
if: steps.commit-and-push.outcome == 'success'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
comment-id: ${{ github.event.comment.id }}
reactions: hooray
- name: react if snapshots were not updated
if: steps.commit-and-push.outcome == 'failure'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
comment-id: ${{ github.event.comment.id }}
reactions: confused
- name: comment if snapshots were not updated
if: steps.commit-and-push.outcome == 'failure'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
issue-number: ${{ github.event.issue.number }}
body: |
@${{ github.actor }} I tried to update the snapshots, but it didn't work. Please update them manually.