Skip to content

Commit

Permalink
Fixup workflow syntax using read and adds parts dir
Browse files Browse the repository at this point in the history
  • Loading branch information
wpears committed Feb 27, 2024
1 parent 319513d commit 1fbd1b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/save-regs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

env:
PARTS: (1003)
PARTS: "1002,1003"

jobs:
save-regs:
Expand All @@ -26,12 +26,14 @@ jobs:
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'"
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: |
for PART in "${PARTS[@]}"; do
curl -sSL "https://www.ecfr.gov/api/renderer/v1/content/enhanced/${DATE}/title-12?chapter=X&part=${PART}" | htmlq -t '.part' | sed '/^$/d' > "./parts/${{ steps.date.outputs.value }}.txt"
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
Expand Down
Empty file added parts/.gitkeep
Empty file.

0 comments on commit 1fbd1b8

Please sign in to comment.