auto-update #916
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: auto-update | |
on: | |
workflow_dispatch: | |
schedule: | |
# Nominally 05:11 GMT+3, but actual start times apparently suffer from delays | |
- cron: '11 2 * * *' | |
permissions: {} | |
defaults: | |
run: | |
shell: bash | |
env: | |
CACHIX_NAME: sigprof | |
nur_channels: nixpkgs-unstable nixos-unstable nixos-24.11 nixos-24.05 nixos-23.11 | |
CI_NIX_INSTALL_URL: https://releases.nixos.org/nix/nix-2.18.1/install | |
NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
item: | |
- pkgs/mozilla-langpack | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Install Nix | |
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 | |
with: | |
install_url: ${{ env.CI_NIX_INSTALL_URL }} | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Setup Cachix | |
uses: cachix/cachix-action@v15 | |
with: | |
name: ${{ env.CACHIX_NAME }} | |
extraPullNames: "pre-commit-hooks" | |
useDaemon: false | |
- name: Run the update script | |
env: | |
item: ${{ matrix.item }} | |
run: | | |
# Run the update script | |
case "$item" in | |
pkgs/mozilla-langpack) | |
set -- @flake | |
for channel in $nur_channels; do | |
set -- "$@" "@$channel" | |
done | |
"$item"/update.sh "$@" | |
;; | |
*) | |
"$item"/update.sh | |
;; | |
esac | |
- name: Generate a GitHub token | |
id: token | |
uses: tibdex/[email protected] | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create a PR | |
id: pr | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ steps.token.outputs.token }} | |
commit-message: "chore(${{ matrix.item }}): Automatic update" | |
author: "sigprof[bot] <108069352+sigprof[bot]@users.noreply.github.com>" | |
branch: "auto-update/${{ matrix.item }}" | |
delete-branch: true | |
title: "chore(${{ matrix.item }}): Automatic update" | |
body: | | |
Automatic update of `${{ matrix.item }}`. | |
Generated by the [GitHub workflow run](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}). | |
labels: "autorebase:opt-in" | |
- name: Enable automerge for the PR | |
if: > | |
steps.pr.outputs.pull-request-operation == 'created' | |
&& ( | |
(matrix.item == 'pkgs/mozilla-langpack') | |
) | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ steps.token.outputs.token }} | |
pull-request-number: ${{ steps.pr.outputs.pull-request-number }} | |
merge-method: squash |