Skip to content

Commit 372cf9d

Browse files
authored
Merge pull request #7 from code2docs-ai/ups216/improve-create-repo
Improve create-repo.yml by checking the Create new repo step to fail the job if the creation is failed
2 parents 4d33e8e + 05e03b2 commit 372cf9d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/create-repo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
3232
- name: Create new repo
3333
run: |
34-
curl -X POST -H "Authorization: token ${{ secrets.MY_PAT }}" \
34+
curl --fail -X POST -H "Authorization: token ${{ secrets.MY_PAT }}" \
3535
-H "Accept: application/vnd.github.v3+json" \
3636
https://api.github.com/orgs/code2docs-ai/repos \
37-
-d '{"name":"${{ env.docs_repo_name }}","private":false}'
37+
-d '{"name":"${{ env.docs_repo_name }}","private":false}' || exit 1

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ This will trigger the workflow and create a new repository in the current organi
3838
### Note
3939

4040
The workflow requires a `GITHUB_TOKEN` secret to authenticate and create the new repository.
41+
42+
### Error Handling
43+
44+
The `Create new repo` step includes error handling to ensure that the job fails if the repository creation fails. The `curl` command used to create the repository includes the `--fail` option to ensure it fails on error, and `|| exit 1` to exit the job if the repository creation fails.

0 commit comments

Comments
 (0)