Skip to content

Commit 828ede6

Browse files
authored
Update poll-and-generate-doc.yml
1 parent ca4a1a7 commit 828ede6

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.github/workflows/poll-and-generate-doc.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,30 @@ jobs:
2222
2323
- name: Fetch file list from integration-resources
2424
run: |
25-
curl -s https://api.github.com/repos/appsmithorg/integration-resources/contents/Generic%20UQI%20Creation/uqi_configs \
26-
| jq -r '.[] | select(.type=="file") | .name' > latest_files.txt
25+
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
26+
-H "Accept: application/vnd.github+json" \
27+
https://api.github.com/repos/appsmithorg/integration-resources/contents/Generic%20UQI%20Creation/uqi_configs \
28+
-o response.json
29+
30+
# Validate it's an array (not an error message)
31+
if ! jq 'type == "array"' response.json | grep -q true; then
32+
echo "❌ GitHub API did not return a file list. Possible error:"
33+
cat response.json
34+
exit 1
35+
fi
36+
37+
jq -r '.[] | select(.type=="file") | .name' response.json > latest_files.txt
2738
2839
- name: Find first unprocessed file
2940
id: detect
3041
run: |
3142
NEW_FILE=$(comm -23 <(sort latest_files.txt) <(sort scripts/processed_files.txt) | head -n 1 || true)
3243
3344
if [ -z "$NEW_FILE" ]; then
34-
echo "No new file to process."
45+
echo "No new file to process."
3546
echo "continue=false" >> $GITHUB_ENV
3647
else
37-
echo "Found new file: $NEW_FILE"
48+
echo "🆕 Found new file: $NEW_FILE"
3849
echo "$NEW_FILE" > scripts/current_file.txt
3950
echo "new_file=$NEW_FILE" >> $GITHUB_ENV
4051
echo "continue=true" >> $GITHUB_ENV
@@ -68,7 +79,7 @@ jobs:
6879
-H "Content-Type: application/json" \
6980
-d "$PAYLOAD" | jq -r '.choices[0].message.content' > extracted_info.md
7081
71-
- name: Generate Markdown (OpenAI Part 2)
82+
- name: Generate Markdown Documentation (OpenAI Part 2)
7283
run: |
7384
SYSTEM_PROMPT=$(cat .github/prompts/generate_prompt.txt)
7485
EXTRACTED_CONTENT=$(cat extracted_info.md)
@@ -87,10 +98,10 @@ jobs:
8798
-H "Content-Type: application/json" \
8899
-d "$PAYLOAD" | jq -r '.choices[0].message.content' > generated_doc.md
89100
90-
- name: Prepare target path
101+
- name: Prepare final markdown path
91102
id: prep
92103
run: |
93-
INTEGRATION=$(echo "${{ env.new_file }}" | sed 's/\.[^.]*$//' | tr '[:upper:]' '[:lower:]')
104+
INTEGRATION=$(echo "${{ env.new_file }}" | sed 's/_uqi_config\.json//' | tr '[:upper:]' '[:lower:]')
94105
FINAL_PATH="website/docs/connect-data/reference/${INTEGRATION}.md"
95106
mkdir -p "$(dirname "$FINAL_PATH")"
96107
cp generated_doc.md "$FINAL_PATH"

0 commit comments

Comments
 (0)