Skip to content
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
23 changes: 19 additions & 4 deletions .github/workflows/observe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
required: true
default: "Bitcoin COVID-19"

permissions:
contents: write

jobs:
observe:
runs-on: ubuntu-latest
Expand All @@ -24,20 +27,32 @@ jobs:
run: bun install --frozen-lockfile && bun run build

- name: Run refract analysis
env:
# Via env rather than ${{ }} interpolation, so a page title cannot
# break out of the string and become shell.
PAGES: ${{ github.event.inputs.pages || 'Bitcoin' }}
run: |
PAGES="${{ github.event.inputs.pages || 'Bitcoin' }}"
mkdir -p observations
for PAGE in $PAGES; do
echo "=== Observing: $PAGE ==="
node packages/cli/dist/src/cli.js analyze "$PAGE" --depth detailed --json \
> "observations/${PAGE//\//_}.json" 2>&1
# Analysis output goes to a temp file first: folding stderr into the
# JSON would commit an error message as though it were an
# observation, and a partial write on failure is worse than none.
if node packages/cli/dist/src/cli.js analyze "$PAGE" --depth detailed --json \
> "$RUNNER_TEMP/observation.json"; then
mv "$RUNNER_TEMP/observation.json" "observations/${PAGE//\//_}.json"
else
echo "::error::analysis failed for $PAGE"
exit 1
fi
done

- name: Commit observations
run: |
git config user.name "refract-bot"
git config user.email "bot@refract-org.github.io"
git add observations/
git diff --quiet && echo "No changes" || {
git diff --cached --quiet && echo "No changes" || {
git commit -m "chore: daily observation $(date -u +%Y-%m-%d)"
git push
}
24 changes: 17 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,25 @@ jobs:

- run: bun install --frozen-lockfile
- run: bun run build
- run: bun test || echo "Tests had failures — publishing anyway"
- run: bun test

- name: Publish packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm --version
# npm 10+ auto-exchanges OIDC token when --provenance is used
# Resolve npm from the Node toolchain explicitly. setup-bun puts a
# bun-backed `npm` earlier in PATH, and bun's implementation does not
# support OIDC token exchange — it fails with
# "missing authentication (run `bunx npm login`)", which is what killed
# every publish from v0.5.8 to v0.5.11.
NPM="$(dirname "$(which node)")/npm"
"$NPM" --version

for pkg in packages/evidence-graph packages/ingestion packages/analyzers packages/cli packages/eval; do
echo "Publishing $pkg..."
cd $pkg
npm publish --access public --provenance || npm publish --access public || true
cd $OLDPWD
echo "::group::Publishing $pkg"
# No `|| true`. A failed publish must fail the run: v0.5.12 reported
# success while every package 404'd on PUT (npm's response to an
# unauthorized write), so the tag looked released and was not.
( cd "$pkg" && "$NPM" publish --access public --provenance )
echo "::endgroup::"
done
Loading