# these dependencies are bumped weekly. But to not add churn
# to master (e.g. downloading changed stuff in nix-shell),
# CI/Mergify is instructed to simply close them as soon as CI is green.
#
# This means that we get an open PR only if something breaks, which is all we
# want to know about.
name: Update niv dependencies (trial)
on:
  # Manual override, one can start the workflow by running:
  # curl -H "Accept: application/vnd.github.everest-preview+json" \
  #  -H "Authorization: token <your-token-here>" \
  #  --request POST \
  #  --data '{"event_type": "niv-updater-nudge", "client_payload": {}}' \
  #  https://api.github.com/repos/dfinity/motoko/dispatches
  # https://help.github.com/en/actions/reference/events-that-trigger-workflows#external-events-repository_dispatch
  repository_dispatch:
    types: niv-updater-nudge
  schedule:
    # * is a special character in YAML so you have to quote this string
    # Run every Monday
    - cron:  '0 0 * * 0'
jobs:
  niv-updater:
    name: 'Check for updates'
    timeout-minutes: 3 # if this takes more than 3 minutes then something's wrong
    runs-on: ubuntu-latest
    steps:
      - name: niv-updater-action
        uses: knl/niv-updater-action@v12
        with:
          whitelist: 'nixpkgs,musl-wasi,ic'
          labels: |
            autoclose
          keep_updating: true
        env:
          GITHUB_TOKEN: ${{ secrets.NIV_UPDATER_TOKEN }}
