@@ -205,15 +205,24 @@ blank_examples:clean_examples
205
205
cd docs; julia notebooks_to_md.jl
206
206
207
207
# @devs
208
- branch_master : error_missing_repos_var
209
- # GitHub merge of `branch` into `master` for a series of repos
210
- # >> make branch_master branch=my_branch repos='FUSE IMAS IMASdd'
211
- @$(foreach repo,$(repos), \
212
- curl -X POST \
213
- -H "Authorization: token $$(security find-generic-password -a orso82 -s GITHUB_TOKEN -w)" \
214
- -H "Accept: application/vnd.github.v3+json" \
215
- https://api.github.com/repos/ProjectTorreyPines/$(repo).jl/merges \
216
- -d '{"base": "master", "head": "$(branch)", "commit_message": "merging $(branch) into master"}';)
208
+ merge_remote : error_missing_repo_var error_missing_branch_var
209
+ # GitHub merge of `branch` into master for a given `repo`
210
+ # >> make merge_remote branch=my_branch repo=FUSE
211
+ @merge_response=$$(curl -s -o /dev/null -w "%{http_code}" -X POST \
212
+ -H "Authorization: token $$(security find-generic-password -a orso82 -s GITHUB_TOKEN -w)" \
213
+ -H "Accept: application/vnd.github.v3+json" \
214
+ https://api.github.com/repos/ProjectTorreyPines/$(repo).jl/merges \
215
+ -d '{"base": "master", "head": "$(branch)", "commit_message": "merging $(branch) into master"}'); \
216
+ echo "Merge response code: $$merge_response"; \
217
+ if [ "$$merge_response" -eq 201 ]; then \
218
+ echo "Merge successful. Deleting branch $(branch) from remote..."; \
219
+ curl -X DELETE \
220
+ -H "Authorization: token $$(security find-generic-password -a orso82 -s GITHUB_TOKEN -w)" \
221
+ -H "Accept: application/vnd.github.v3+json" \
222
+ https://api.github.com/repos/ProjectTorreyPines/$(repo).jl/git/refs/heads/$(branch); \
223
+ else \
224
+ echo "Merge failed with status code $$merge_response. Branch $(branch) was not deleted."; \
225
+ fi
217
226
218
227
# @devs
219
228
bump_major : error_missing_repo_var error_on_last_commit_is_a_version_bump versions_used
@@ -496,10 +505,10 @@ ifeq ($(repo),)
496
505
endif
497
506
498
507
# @devs
499
- error_missing_repos_var :
500
- # Throw an error if environment variable `repos ` is not set
501
- ifeq ($(repo ) ,)
502
- $(error `repos ` variable is not set)
508
+ error_missing_branch_var :
509
+ # Throw an error if environment variable `branch ` is not set
510
+ ifeq ($(branch ) ,)
511
+ $(error `branch ` variable is not set)
503
512
endif
504
513
505
514
# @devs
0 commit comments