# SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
#
# SPDX-License-Identifier: GPL-3.0-only

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: pacakages.lock

on:
  workflow_dispatch:
  schedule:
    - cron: '27 15 * * *'

permissions: read-all

jobs:
  check:
    runs-on: ubuntu-latest

    permissions:
      contents: write
      pull-requests: write

    steps:
      - uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          # NOTE: caching seems to actually slow down the build, both on hit and on miss
          cache: false
          cache-dependency-path: '**/packages.lock.json'

      - name: Evaluate dependencies
        run: |
          dotnet restore --force-evaluate
          dotnet restore --force-evaluate Installer

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v7
        with:
          commit-message: 'Update packages.lock.json'
          title: 'Update packages.lock.json'
          branch: update-packages-lock
          body: |
            This is an automated pull request, updating `packages.lock.json` after a detected change.
            Please review manually before merging.