Skip to content

Weekly cargo-mutants #1

Weekly cargo-mutants

Weekly cargo-mutants #1

name: Weekly cargo-mutants
on:
schedule:
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
workflow_dispatch: # allows manual triggering
permissions: {}
jobs:
cargo-mutants:
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: taiki-e/install-action@81ee1d48d9194cdcab880cbdc7d36e87d39874cb # v2.62.45
with:
tool: cargo-mutants
- run: cargo mutants --in-place --no-shuffle
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: always()
with:
name: mutants.out
path: mutants.out
- name: Check for new mutants
if: always()
run: |
if [ -s mutants.out/missed.txt ]; then
echo "New missed mutants found"
MUTANTS_VERSION=$(cargo mutants --version)
gh issue create \
--title "New Mutants Found" \
--body "$(cat <<EOF
Displaying up to the first 10 mutants:
\`\`\`
$(head -n 10 mutants.out/missed.txt)
\`\`\`
Running cargo mutants version: ${MUTANTS_VERSION}
For the complete list, please check the [mutants.out artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
EOF
)"
echo "create_issue=true" >> $GITHUB_ENV
else
echo "No new mutants found"
echo "create_issue=false" >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}