diff --git a/.github/workflows/bot.yml b/.github/workflows/bot.yml index e69de29b..0ac745e0 100644 --- a/.github/workflows/bot.yml +++ b/.github/workflows/bot.yml @@ -0,0 +1,38 @@ +on: + issue_comment: + types: [created, edited] + +name: bot + +jobs: + pr_commented: + # This job only runs for pull request comments + name: PR comment + if: ${{ github.event.issue.pull_request && github.event.comment.body == '/snapshot' }} + strategy: + # Do not run in parallel because we may create a new commit + max-parallel: 1 + matrix: + name: [windows, linux] + include: + - name: windows + os: windows-latest + - name: linux + os: ubuntu-latest + runs-on: ${{ matrix.os }} + env: + # Set TRYCMD=overwrite to update snapshot + TRYCMD: overwrite + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/cargo@v1 + # Generate new snapshots + with: + command: test + args: cli_tests + - run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "test: update snapshot for ${{ matrix.name }}" + git push