Skip to content

Commit 9fd21b5

Browse files
authored
Update sample-file-trigger.yml
1 parent 3fb39ea commit 9fd21b5

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

.github/workflows/sample-file-trigger.yml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Process Sample Files and Create PR
1+
name: Generate Integration Docs and Create PR
22

33
on:
44
push:
55
paths:
66
- 'website/docs/sample-workflow-tests/**'
77

88
jobs:
9-
generate_docs_and_pr:
9+
generate_docs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
@@ -26,9 +26,9 @@ jobs:
2626
echo "New file detected: $ADDED_FILE"
2727
echo "file_path=$ADDED_FILE" >> $GITHUB_ENV
2828
29-
- name: Show file name and content
29+
- name: Read file content
3030
run: |
31-
echo "Reading content of: ${{ env.file_path }}"
31+
echo "Reading: ${{ env.file_path }}"
3232
cat "${{ env.file_path }}"
3333
cp "${{ env.file_path }}" input_file.txt
3434
@@ -70,42 +70,35 @@ jobs:
7070
-H "Content-Type: application/json" \
7171
-d "$PAYLOAD" | jq -r '.choices[0].message.content' > generated_doc.md
7272
73-
- name: Prepare output path and filename
73+
- name: Prepare target path
7474
id: prepare_path
7575
run: |
7676
RAW_FILENAME=$(basename "${{ env.file_path }}")
7777
INTEGRATION_NAME=$(echo "$RAW_FILENAME" | sed 's/\.[^.]*$//' | tr '[:upper:]' '[:lower:]')
78-
TARGET_PATH="connect-data/reference/${INTEGRATION_NAME}.md"
78+
TARGET_PATH="website/docs/connect-data/reference/${INTEGRATION_NAME}.md"
7979
80-
echo "Creating path: $TARGET_PATH"
81-
mkdir -p "$(dirname $TARGET_PATH)"
80+
echo "Target file: $TARGET_PATH"
81+
mkdir -p "$(dirname "$TARGET_PATH")"
8282
cp generated_doc.md "$TARGET_PATH"
8383
8484
echo "integration_name=$INTEGRATION_NAME" >> $GITHUB_ENV
8585
echo "target_path=$TARGET_PATH" >> $GITHUB_ENV
8686
87-
- name: Commit and push changes to new branch
88-
run: |
89-
BRANCH_NAME="auto/docs-${{ env.integration_name }}"
90-
91-
git config user.name "github-actions[bot]"
92-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
93-
94-
git checkout -b "$BRANCH_NAME"
95-
git add "${{ env.target_path }}"
96-
git commit -m "docs: add integration reference for ${{ env.integration_name }}"
97-
git push origin "$BRANCH_NAME"
98-
99-
- name: Create Pull Request
87+
- name: Commit and create PR
10088
uses: peter-evans/create-pull-request@v5
10189
with:
10290
token: ${{ secrets.GITHUB_TOKEN }}
10391
title: "docs: add ${{ env.integration_name }} integration reference"
104-
commit-message: "docs: add integration reference for ${{ env.integration_name }}"
92+
commit-message: "docs: add reference for ${{ env.integration_name }}"
10593
branch: "auto/docs-${{ env.integration_name }}"
10694
base: main
95+
add-paths: |
96+
${{ env.target_path }}
10797
body: |
108-
This PR was automatically generated from a newly added sample file for **${{ env.integration_name }}**.
98+
This PR adds the generated integration reference for **${{ env.integration_name }}** to:
99+
100+
```
101+
/website/docs/connect-data/reference/${{ env.integration_name }}.md
102+
```
109103
110-
The integration reference documentation has been created at:
111-
`/connect-data/reference/${{ env.integration_name }}.md`
104+
Generated automatically from sample workflow input.

0 commit comments

Comments
 (0)