Skip to content

Commit 317b484

Browse files
authored
Merge pull request #14 from code2docs-ai/ups216/add-validation-repoUrl
Improve create-repo.yml by adding validation for repoUrl
2 parents 010ef64 + 781639f commit 317b484

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.github/workflows/create-repo.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
echo "repoUrl: ${{ github.event.inputs.repoUrl }}"
2020
echo "branchName: ${{ github.event.inputs.branchName }}"
2121
22+
- name: Validate repoUrl
23+
run: |
24+
if [[ "${{ github.event.inputs.repoUrl }}" != https://github.com/* ]]; then
25+
echo "Error: repoUrl must be a GitHub.com address and a HTTPS address."
26+
exit 1
27+
fi
28+
2229
- name: Extract orgName and repoName
2330
id: extract
2431
run: |

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To use this GitHub Action workflow, follow these steps:
1414

1515
2. The workflow will perform the following steps:
1616
- Print out the input parameters values in the workflow log.
17+
- Validate that the `repoUrl` is a GitHub.com address and a HTTPS address. If not, the job will fail.
1718
- Extract the `orgName` and `repoName` from the `repoUrl`, and concatenate them to form another parameter `docs_repo_name` = `orgName_repoName`.
1819
- Check if the repository `docs_repo_name` exists using the GitHub API.
1920
- If the repository exists, delete it before creating a new one.

0 commit comments

Comments
 (0)