Skip to content

Update dependencies #450

Update dependencies

Update dependencies #450

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Update dependencies
on:
pull_request:
schedule:
- cron: "41 14 * * *"
workflow_dispatch:
jobs:
dependabot:
name: Merge automatic pull requests
if: github.actor == 'dependabot[bot]'
runs-on: self-hosted
timeout-minutes: 12
permissions:
actions: write
contents: write
pull-requests: write
steps:
- name: Collect update metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout this repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: "0"
persist-credentials: true
ref: ${{ github.head_ref }}
- name: Configure git credentials
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Start the tests
run: |
shopt -s globstar
nix develop -c zig fmt --check ./src/**/*.zig
nix develop -c zig build
nix develop -c zig build test
- name: Merge requests from the kind dependabot
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr merge --auto --squash "$PR_URL"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
- name: Perform more tests
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPO/actions/workflows/test.yml/dispatches" \
-f "ref=main"
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
flake:
name: Freeze the latest lockfile
if: github.event_name != 'pull_request'
runs-on: self-hosted
permissions:
actions: write
contents: write
steps:
- name: Checkout this repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true
ref: main
- name: Configure git credentials
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Checkout an update
run: |
git checkout -b update
- name: Update to the latest
run: |
nix flake update
- name: Check for changes
id: diff
run: |
if ! git diff --quiet; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Save the flake locks
if: steps.diff.outputs.changed == 'true'
run: |
git rev-parse --verify --quiet origin/update >/dev/null &&
[ "$(git rev-list --count origin/main..origin/update 2>/dev/null)" -ne 1 ] &&
exit 1
git switch --force-create update origin/main
git commit --all --message "chore(deps): automatic version bump to the most recent packages"
git push -f origin update
- name: Start the tests
if: steps.diff.outputs.changed == 'true'
run: |
shopt -s globstar
nix develop -c zig fmt --check ./src/**/*.zig
nix develop -c zig build
nix develop -c zig build test
- name: Save changed version
if: steps.diff.outputs.changed == 'true'
run: |
git checkout main
git merge update
git push -u origin main
git push origin --delete update
- name: Confirm the tests
if: steps.diff.outputs.changed == 'true'
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPO/actions/workflows/test.yml/dispatches" \
-f "ref=main"
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}