Repository navigation
70 lines (68 loc) · 2.74 KB
/
Copy pathpullfrog.yml
File metadata and controls
70 lines (68 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# PULLFROG ACTION - DO NOT EDIT EXCEPT WHERE INDICATED
name: Pullfrog
run-name: ${{ inputs.name || github.workflow }}
on:
workflow_dispatch:
inputs:
prompt:
type: string
description: Agent prompt
name:
type: string
description: Run name
permissions:
contents: read
jobs:
pullfrog:
runs-on: ubuntu-latest
# Only main may deploy to this environment, so a dispatch on a pushed
# branch can't mint the OIDC token Pullfrog trades for model access.
environment: pullfrog
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
# Edited: what the review needs to run the repository's checks and
# tests. The environment admits only main, so the dev shell comes from
# the default branch, not a pull request's head.
- uses: cachix/install-nix-action@bb0495a1086c46893eee56f32fd192dfe4a15bb9 # v32.0.0
with:
# The agent's shell can reach the daemon and read /etc/nix: keep
# the runner user untrusted, since a trusted user's settings, such
# as a post-build-hook, run as root.
set_as_trusted_user: false
# The action writes the job's token into nix.conf and has no input to
# skip it, so drop it before the agent can read /etc/nix.
- name: Keep the job token out of Nix's config
run: sudo sed -i '/^access-tokens/d' /etc/nix/nix.conf
- name: Put the dev shell's tools on PATH
# bash, not the default shell, for pipefail: a failing print-dev-env
# must fail the step, not write an empty PATH.
shell: bash
env:
# Authenticated fetches of the flake's inputs, for this step only.
NIX_CONFIG: access-tokens = github.com=${{ github.token }}
TOKEN: ${{ github.token }}
run: |
nix print-dev-env --json |
jq -r '.variables.PATH.value' |
tr ':' '\n' | grep '^/nix/store/' | paste -sd: >>"$GITHUB_PATH"
if sudo grep -rqF "$TOKEN" /etc/nix; then
echo "the job token reached Nix's config" >&2
exit 1
fi
if ! nix store info --json | jq -e '.trusted == false or .trusted == 0' >/dev/null; then
echo "the Nix daemon trusts the runner user" >&2
exit 1
fi
- name: Run agent
uses: pullfrog/pullfrog@0741f79ecebfa4469a010644d2aed2d96d32d489 # v0.1.127
with:
prompt: ${{ inputs.prompt }}
# No provider keys from this repository: model access is configured
# in the Pullfrog console (https://docs.pullfrog.com/model-access).