Skip to content

Commit 781639f

Browse files
committed
Improve create-repo.yml by adding validation for repoUrl
Related to #13 Add validation for `repoUrl` in `create-repo.yml` workflow. * **Validation Step**: Add a step to validate that `repoUrl` starts with "https://github.com/". If not, the job fails with an appropriate error message. * **README Update**: Update `README.md` to include information about the new validation step for `repoUrl`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/code2docs-ai/code2docs-ai-core/issues/13?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 010ef64 commit 781639f

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)