Skip to content

Save regs

Save regs #14

Workflow file for this run

name: Save regs
on:
workflow_dispatch:
env:
PARTS: "1002,1003"
jobs:
save-regs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Installs htmlq
uses: baptiste0928/[email protected]
with:
crate: htmlq
version: "0.4.0"
- name: Find latest date
id: date
uses: sergeysova/jq-action@a3f0d4ff59cc1dddf023fc0b325dd75b10deec58
with:
cmd: "curl -sSL https://www.ecfr.gov/api/versioner/v1/titles.json | jq '.titles[] | select(.number == 12) | .up_to_date_as_of' | tr -d '\"'"
- name: Fetch and extract parts from eCFR
run: |
IFS="," read -a BASH_PARTS <<< "$PARTS"
for PART in "${BASH_PARTS[@]}"; do
echo "$PART"
curl -sSL "https://www.ecfr.gov/api/renderer/v1/content/enhanced/${{ steps.date.outputs.value }}/title-12?chapter=X&part=${PART}" | htmlq -t '.part' | sed '/^$/d' > "./parts/${PART}.txt"
done
- name: Test output
run: ls -l parts
- name: Show output
run: cat ./parts/1003.txt