summaryrefslogtreecommitdiffhomepage
path: root/.github
diff options
context:
space:
mode:
authorAlbert O'Shea <[email protected]>2025-11-18 17:46:49 +1100
committerGitHub <[email protected]>2025-11-18 00:46:49 -0600
commit5e13527416e183c7ea6d1baa3528b5c30108372e (patch)
tree6d839be0118b84974eacc670a93823974787faba /.github
parentaba94c658f5c0987443196a5e850fdf7293d5006 (diff)
downloadopencode-5e13527416e183c7ea6d1baa3528b5c30108372e.tar.gz
opencode-5e13527416e183c7ea6d1baa3528b5c30108372e.zip
feat: nix support for the nix folks (#3924)
Co-authored-by: opencode <[email protected]> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/update-nix-hashes.yml79
1 files changed, 79 insertions, 0 deletions
diff --git a/.github/workflows/update-nix-hashes.yml b/.github/workflows/update-nix-hashes.yml
new file mode 100644
index 000000000..fe388697e
--- /dev/null
+++ b/.github/workflows/update-nix-hashes.yml
@@ -0,0 +1,79 @@
+name: Update Nix Hashes
+
+permissions:
+ contents: write
+
+on:
+ workflow_dispatch:
+ push:
+ paths:
+ - 'bun.lock'
+ - 'package.json'
+ - 'packages/*/package.json'
+ pull_request:
+ paths:
+ - 'bun.lock'
+ - 'package.json'
+ - 'packages/*/package.json'
+
+jobs:
+ update:
+ runs-on: ubuntu-latest
+ env:
+ SYSTEM: x86_64-linux
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ fetch-depth: 0
+
+ - name: Setup Nix
+ uses: DeterminateSystems/nix-installer-action@v20
+
+ - name: Configure git
+ run: |
+ git config --global user.email "[email protected]"
+ git config --global user.name "opencode"
+
+ - name: Update node_modules hash
+ run: |
+ set -euo pipefail
+ nix/scripts/update-hashes.sh
+
+ - name: Commit hash changes
+ env:
+ TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
+ run: |
+ set -euo pipefail
+
+ summarize() {
+ local status="$1"
+ {
+ echo "### Nix Hash Update"
+ echo ""
+ echo "- ref: ${GITHUB_REF_NAME}"
+ echo "- status: ${status}"
+ } >> "$GITHUB_STEP_SUMMARY"
+ if [ -n "${GITHUB_SERVER_URL:-}" ] && [ -n "${GITHUB_REPOSITORY:-}" ] && [ -n "${GITHUB_RUN_ID:-}" ]; then
+ echo "- run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"
+ fi
+ echo "" >> "$GITHUB_STEP_SUMMARY"
+ }
+
+ FILES=(flake.nix nix/node-modules.nix nix/hashes.json)
+ STATUS="$(git status --short -- "${FILES[@]}" || true)"
+ if [ -z "$STATUS" ]; then
+ summarize "no changes"
+ echo "No changes to tracked Nix files. Hashes are already up to date."
+ exit 0
+ fi
+
+ git add "${FILES[@]}"
+ git commit -m "Update Nix hashes"
+
+ BRANCH="${TARGET_BRANCH:-${GITHUB_REF_NAME}}"
+ git push origin HEAD:"$BRANCH"
+
+ summarize "committed $(git rev-parse --short HEAD)"