2.4 KiB · text History a1e6e1c
name: dependency-updates
# Security updates as a pull request: scripts/dependency-update finds the
# Hex dependencies with a known vulnerability (osv-scanner, against OSV)
# that a newer version fixes, bumps them, and keeps one pull request —
# deps/security-hex — refreshed in place, closing it once there's
# nothing left to fix. The pull request is opened by the forge's CI
# account (gg-security) with this job's own token; its CI (audit.yml,
# and ci.yml's build and tests) is what shows the fixes landed.
#
# Daily, before the nightly audit, and by hand from the Actions page
# (`gg ci dispatch dependency-updates`). Taken from gitgud's workflow of
# the same name.
on:
  schedule:
    - cron: "35 5 * * *"
  workflow_dispatch:

permissions:
  contents: write # push the deps/security-hex branch
  pull-requests: write # open, refresh and close its pull request

jobs:
  update:
    runs-on: arc-runner-set
    steps:
      - uses: actions/checkout@v4
        with:
          # The deps/security-hex branch too, to tell whether a refresh
          # changed anything before pushing it.
          fetch-depth: 0

      # The toolchain ci.yml builds and tests with: a lockfile is only as
      # good as the resolver that wrote it. Through the same forge fork of
      # setup-beam, which defaults ImageOS to ubuntu-24.04 rather than the
      # unmappable one forgejo/act injects from the runs-on label.
      - uses: https://gg.neiam.co/neiam/action-setup-beam@v1
        with:
          elixir-version: "1.17.3"
          otp-version: "27.3.4.11"

      - name: Hex
        run: mix local.hex --force

      # Pinned and checked, as in audit.yml; bump both together.
      - name: Fetch osv-scanner
        env:
          OSV_VERSION: v2.6.0
          OSV_SHA256: ca69b3d3cd08f889a49dc0a383122f71cc528b83803671df5fd874d97485b108
        run: |
          curl -sSfL -o /tmp/osv-scanner \
            "https://github.com/google/osv-scanner/releases/download/${OSV_VERSION}/osv-scanner_linux_amd64"
          echo "${OSV_SHA256}  /tmp/osv-scanner" | sha256sum -c -
          chmod +x /tmp/osv-scanner

      # The script sets its own git identity (gg-security) before it
      # commits: a fresh container has none.
      - name: Update
        env:
          OSV_SCANNER: /tmp/osv-scanner
          GITHUB_TOKEN: ${{ github.token }}
        run: scripts/dependency-update --base "${{ github.ref_name }}"