ghostty/.github/workflows/update-colorschemes.yml
2025-07-06 06:59:50 -07:00

78 lines
2.8 KiB
YAML

name: Update iTerm2 colorschemes
on:
schedule:
# Once a week
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
update-iterm2-schemes:
if: github.repository == 'ghostty-org/ghostty'
runs-on: namespace-profile-ghostty-sm
permissions:
# Needed for create-pull-request action
contents: write
pull-requests: write
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Cache
uses: namespacelabs/nscloud-cache-action@449c929cd5138e6607e7e78458e88cc476e76f89 # v1.2.8
with:
path: |
/nix
/zig
- name: Setup Nix
uses: cachix/install-nix-action@f0fe604f8a612776892427721526b4c7cfb23aba # v31.4.1
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Run zig fetch
id: zig_fetch
run: |
UPSTREAM_REV="$(curl "https://api.github.com/repos/mbadolato/iTerm2-Color-Schemes/commits/master" | jq -r '.sha')"
nix develop -c zig fetch --save="iterm2_themes" "https://github.com/mbadolato/iTerm2-Color-Schemes/archive/$UPSTREAM_REV.tar.gz"
echo "upstream_rev=$UPSTREAM_REV" >> "$GITHUB_OUTPUT"
- name: Update zig cache hash
run: |
# Only proceed if build.zig.zon has changed
if ! git diff --exit-code build.zig.zon; then
nix develop -c ./nix/build-support/check-zig-cache.sh --update
nix develop -c ./nix/build-support/check-zig-cache.sh
nix develop -c ./flatpak/build-support/check-zig-cache.sh --update
nix develop -c ./flatpak/build-support/check-zig-cache.sh
fi
# Verify the build still works. We choose an arbitrary build type
# as a canary instead of testing all build types.
- name: Test Build
run: nix build .#ghostty
- name: Create pull request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
title: Update iTerm2 colorschemes
base: main
branch: iterm2_colors_action
commit-message: "deps: Update iTerm2 color schemes"
add-paths: |
build.zig.zon
build.zig.zon.nix
build.zig.zon.txt
build.zig.zon.json
flatpak/zig-packages.json
body: |
Upstream revision: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/${{ steps.zig_fetch.outputs.upstream_rev }}
labels: dependencies