chore: Add wowkflow to update snapshots #1
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: snapshot | |
on: | |
push: | |
branches: | |
- chore-add-snapshot-update-workflow | |
workflow_dispatch: | |
inputs: | |
dryrun: | |
type: boolean | |
description: Set `true` to skip diff commits. | |
default: true | |
jobs: | |
snapshot: | |
runs-on: ${{ matrix.os }} | |
environment: ci | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.target_branch }} | |
lfs: true | |
# Build projects | |
- uses: ./.github/actions/build | |
- run: dotnet build -c Release samples/extensions/build | |
# Update snapshots | |
- run: dotnet test -c Release -f net8.0 --no-build --filter Stage=Snapshot | |
working-directory: test/docfx.Snapshot.Tests | |
env: | |
BUILD_SERVER: false # Accept changes automatically | |
# Output git diff to Job Summary | |
- run: git diff --name-status >> $GITHUB_STEP_SUMMARY | |
# Commit updated snapshot contents | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: ${{ github.event.inputs.dryrun }} != 'true' | |
with: | |
commit_message: 'test(snapshot): update snapshots ${{ github.sha }} for ${{ matrix.os }}' |