Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #47 from samcontesse/export-source-branch-name
Browse files Browse the repository at this point in the history
Export source branch name
  • Loading branch information
samcontesse authored Jan 8, 2022
2 parents 0e1bb41 + 7dd3923 commit 3ef2e95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Checks if there are new merge requests or merge requests with new commits.

`git clone`s the source branch of the respective merge request.

If you need to retrieve any information about the merge request in your tasks, the script writes the raw API response of the
[get single merge request call](https://docs.gitlab.com/ee/api/merge_requests.html#get-single-mr) to `.git/merge-request.json`.
The name of the source branch is extracted to `.git/merge-request-source-branch` for convenience.

### `out`: Update a merge request's merge status

Updates the merge request's `merge_status` which displays nicely in the GitLab UI and allows to only merge changes if they pass the test.
Expand Down
3 changes: 2 additions & 1 deletion in/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func main() {
execGitCommand([]string{"merge", "--no-ff", "--no-commit", mr.SHA})

notes, _ := json.Marshal(mr)
err = ioutil.WriteFile(".git/merge-request.json", notes, 0644)
ioutil.WriteFile(".git/merge-request.json", notes, 0644)
ioutil.WriteFile(".git/merge-request-source-branch", []byte(mr.SourceBranch), 0644)

response := in.Response{Version: request.Version, Metadata: buildMetadata(mr, commit)}

Expand Down

0 comments on commit 3ef2e95

Please sign in to comment.