Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions .github/workflows/update-template-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,19 @@ jobs:
nf-test test \
--profile=+docker \
--verbose
--update-snapshot

- name: Update nf-test snapshot
- name: Copy snapshot to .github/snapshots
if: steps.nf-test.outcome == 'success'
run: |
cp ${{ github.workspace }}/create-test-lint-wf/my-prefix-testpipeline/tests/default.nf.test.snap ${{ github.workspace }}/.github/snapshots/${{ matrix.TEMPLATE }}.nf.test.snap
cp create-test-lint-wf/my-prefix-testpipeline/tests/default.nf.test.snap .github/snapshots/${{ matrix.TEMPLATE }}.nf.test.snap

- name: Upload snapshot artifact
if: steps.nf-test.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: snapshot-${{ matrix.TEMPLATE }}
path: .github/snapshots/${{ matrix.TEMPLATE }}.nf.test.snap

# indication that the run has finished
- name: react if finished succesfully
Expand All @@ -132,15 +140,34 @@ jobs:
comment-id: ${{ github.event.comment.id }}
reactions: "+1"

commit-snapshots:
needs: [prepare-matrix, update-snapshots]
runs-on: ubuntu-latest
if: always() && needs.update-snapshots.result != 'skipped'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
token: ${{ secrets.nf_core_bot_auth_token }}

- name: Checkout Pull Request
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }}

- name: Download all snapshot artifacts
uses: actions/download-artifact@v4
with:
pattern: snapshot-*
path: .github/snapshots/
merge-multiple: true

- name: Commit & push changes
id: commit-and-push
if: steps.nf-test.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 add .github/snapshots/
git diff --staged --quiet && echo "No snapshot changes to commit" && exit 0
git commit -m "[automated] Update Template snapshots"
git push

Expand All @@ -160,7 +187,7 @@ jobs:
reactions: confused

- name: react if snapshots were not updated
if: steps.commit-and-push.outcome == 'failure'
if: steps.commit-and-push.outcome == 'failure'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
issue-number: ${{ github.event.issue.number }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Update GitHub Actions ([#4067](https://github.com/nf-core/tools/pull/4067))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.15.4 ([#4069](https://github.com/nf-core/tools/pull/4069))
- bump nf-test to 0.9.4 ([#4079](https://github.com/nf-core/tools/pull/4079))
- nf-core bot: collect all snapshots before commiting ([#4082](https://github.com/nf-core/tools/pull/4082))
- Update GitHub Actions to v4 (major) ([#4081](https://github.com/nf-core/tools/pull/4081))

### Linting
Expand Down
Loading