Skip to content

Update Sandbox

Update Sandbox #112

name: Update Sandbox
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # zizmor: ignore[artipacked] this job commits and force-pushes the update/sandbox branch, so it needs the persisted GITHUB_TOKEN
with:
ref: devel
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- uses: rui314/setup-mold@7e4f20ad28a2e8ca6fd0892ccf72e2abb706b9c3 # v1
with:
mold-version: "2.34.1"
- name: Update sandbox dependencies
id: update
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
output=$(cargo update-sandbox)
echo "$output"
echo "summary<<EOF" >> "$GITHUB_OUTPUT"
echo "$output" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create or update PR
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
SUMMARY: ${{ steps.update.outputs.summary }}
run: |
git config user.name "Bencher"
git config user.email "git@bencher.dev"
branch="update/sandbox"
git checkout -B "$branch"
git add plus/bencher_runner/build.rs
git commit -m "$SUMMARY"
git push -u origin "$branch" --force
existing=$(gh pr list --head "$branch" --base devel --json number -q '.[0].number')
if [ -z "$existing" ]; then
gh pr create \
--base devel \
--head "$branch" \
--title "$SUMMARY" \
--body "Automated update of bundled Firecracker and/or kernel in the runner sandbox." \
--label "dependencies" \
--label "deploy"
fi