nixvim/.github/workflows/update-flake.yaml
Roel de Cort 70c6ca87ff
chore(deps): update determinatesystems/nix-installer-action action to v17 (#93)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[DeterminateSystems/nix-installer-action](https://redirect.github.com/DeterminateSystems/nix-installer-action)
| action | major | `v16` -> `v17` |

---

### Release Notes

<details>
<summary>DeterminateSystems/nix-installer-action
(DeterminateSystems/nix-installer-action)</summary>

###
[`v17`](https://redirect.github.com/DeterminateSystems/nix-installer-action/releases/tag/v17)

[Compare
Source](https://redirect.github.com/DeterminateSystems/nix-installer-action/compare/v16...v17)

##### What's Changed

- Annotate hash mismatches when Determinate features are enabled by
[@&#8203;gustavderdrache](https://redirect.github.com/gustavderdrache)
in
[https://github.com/DeterminateSystems/nix-installer-action/pull/158](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/158)
- Summarize the build timeline by
[@&#8203;grahamc](https://redirect.github.com/grahamc) in
[https://github.com/DeterminateSystems/nix-installer-action/pull/165](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/165)
- Don't blow the limits of summaries, by not printing logs if it blows
the limit by [@&#8203;grahamc](https://redirect.github.com/grahamc) in
[https://github.com/DeterminateSystems/nix-installer-action/pull/168](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/168)
- Show diagnostics for FlakeHub login issues by
[@&#8203;gustavderdrache](https://redirect.github.com/gustavderdrache)
in
[https://github.com/DeterminateSystems/nix-installer-action/pull/169](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/169)
- chore: detect existing `nix` installations by
[@&#8203;dpc](https://redirect.github.com/dpc) in
[https://github.com/DeterminateSystems/nix-installer-action/pull/139](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/139)
- Check whether the current user has access to KVM before attempting to
add udev rule by
[@&#8203;JTKBowers](https://redirect.github.com/JTKBowers) in
[https://github.com/DeterminateSystems/nix-installer-action/pull/141](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/141)

##### New Contributors

- [@&#8203;gustavderdrache](https://redirect.github.com/gustavderdrache)
made their first contribution in
[https://github.com/DeterminateSystems/nix-installer-action/pull/158](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/158)
- [@&#8203;dpc](https://redirect.github.com/dpc) made their first
contribution in
[https://github.com/DeterminateSystems/nix-installer-action/pull/139](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/139)
- [@&#8203;JTKBowers](https://redirect.github.com/JTKBowers) made their
first contribution in
[https://github.com/DeterminateSystems/nix-installer-action/pull/141](https://redirect.github.com/DeterminateSystems/nix-installer-action/pull/141)

**Full Changelog**:
https://github.com/DeterminateSystems/nix-installer-action/compare/v16...v17

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTkuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI1OS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: Renovate Bot <renovate@whitesourcesoftware.com>
2025-06-02 17:28:14 +02:00

151 lines
5.1 KiB
YAML

name: Update Flake and Validate Build
on:
schedule:
- cron: "30 00 * * 1"
workflow_dispatch: # Allow manual triggering
# Set default permissions as read only
permissions: read-all
jobs:
update-flake:
runs-on: ubuntu-latest
permissions:
# Only need contents write to update the flake lock file
contents: write
outputs:
update_available: ${{ steps.check_updates.outputs.update_available }}
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v17
- name: Check for Updates
id: check_updates
run: |
# Create a temporary copy of flake.lock
cp flake.lock flake.lock.backup
# Try to update flake.lock
nix flake update
# Check if there are differences
if ! cmp -s flake.lock flake.lock.backup; then
echo "update_available=true" >> "$GITHUB_OUTPUT"
# Restore original flake.lock
mv flake.lock.backup flake.lock
else
echo "update_available=false" >> "$GITHUB_OUTPUT"
fi
- name: Update flake.lock
if: steps.check_updates.outputs.update_available == 'true'
uses: DeterminateSystems/update-flake-lock@v25
with:
nix-options: --debug --log-format raw
token: ${{ secrets.FLAKE_TOKEN }}
pr-title: "deps: update flake.lock"
pr-labels: |
dependencies
automated
build-and-check:
needs: update-flake
permissions:
# Needed for checking out code
contents: read
# Needed for creating issues
issues: write
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false # Continue with other jobs even if one fails
runs-on: ${{ matrix.os }}
steps:
- name: Repository Checkout
uses: actions/checkout@v4
with:
ref: update_flake_lock_action
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v17
- name: Build and Test Configuration
id: build
continue-on-error: true # Continue to next steps even if build fails
run: |
set +e # Don't exit immediately on error
# Run the build and capture output
OUTPUT=$(nix build .# 2>&1)
BUILD_EXIT_CODE=$?
echo "build_output<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Check if build succeeded
if [ $BUILD_EXIT_CODE -eq 0 ]; then
echo "build_status=success" >> $GITHUB_ENV
else
echo "build_status=failure" >> $GITHUB_ENV
# Ensure the error is visible in the logs
echo "::error::Build failed with exit code $BUILD_EXIT_CODE"
echo "$OUTPUT"
fi
- name: Create Issue on Build Failure
if: env.build_status == 'failure'
uses: actions/github-script@v7
with:
script: |
const os = '${{ matrix.os }}';
const buildOutput = process.env.build_output;
const isUpdate = '${{ needs.update-flake.outputs.update_available }}' === 'true';
// Extract warnings and errors from build output
const warnings = buildOutput.match(/evaluation warning:[^\n]+/g) || [];
const errors = buildOutput.match(/error:[^\n]+/g) || [];
// Create a summary section
const summary = [
warnings.length > 0 ? `${warnings.length} evaluation warnings` : '',
errors.length > 0 ? `${errors.length} errors` : ''
].filter(Boolean).join(' and ');
// Get repository information from context
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
await github.rest.issues.create({
owner,
repo,
title: `🔨 Build Failed on ${os}: ${summary}${isUpdate ? ' (Dependency Update)' : ''}`,
body: `Build failed during automated validation on ${os}${isUpdate ? ' while testing dependency updates.' : '.'}\n
${isUpdate ? 'This failure occurred on the dependency update branch `deps/update-flake-lock`.' : 'This failure occurred on the main branch.'}\n
### Summary
${summary}\n
${warnings.length > 0 ? `### Warnings\n\`\`\`\n${warnings.join('\n')}\n\`\`\`\n` : ''}
${errors.length > 0 ? `### Errors\n\`\`\`\n${errors.join('\n')}\n\`\`\`\n` : ''}
<details>
<summary>Build Output</summary>
\`\`\`
${buildOutput}
\`\`\`
</details>
Please review the build output and fix any issues.`,
labels: [
'build-failure',
'bug',
...(warnings.length > 0 ? ['has-warnings'] : []),
...(errors.length > 0 ? ['has-errors'] : [])
]
});