Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nix bash script #325

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/generate_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
message:
description: "Message to include in the generated commits:"
required: true
dry-run:
description: "Dry Run (PRs are not generated)"
type: boolean
default: true

jobs:
create-prs:
Expand All @@ -23,6 +27,7 @@ jobs:
sudo apt-add-repository ppa:ansible/ansible -y && \
sudo apt install -y ansible

# NOTE (@NickLarsenNZ): This could be removed in favor of nix-shell and rrbutani/use-nix-shell-action
- name: Install deps for operators
run: |
sudo apt-get install \
Expand All @@ -49,9 +54,17 @@ jobs:

# Generate PRs
- name: Run playbook
if: ${{ !inputs.dry-run }}
run: |
# Funnel via JSON to ensure that values are escaped properly
echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, reason: $ENV.REASON, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json"
env:
GH_ACCESS_TOKEN: ${{ secrets.gh_access_token }}

# Do Not Generate PRs
- name: Run playbook (dry-run)
if: ${{ inputs.dry-run }}
run: ./test
env:
GH_ACCESS_TOKEN: ""
1 change: 1 addition & 0 deletions template/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ rec {

regenerateNixLockfiles = pkgs.writeScriptBin "regenerate-nix-lockfiles"
''
#!/usr/bin/env bash
set -euo pipefail
echo Running crate2nix
${crate2nix}/bin/crate2nix generate
Expand Down