File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7575 - name : get current reference
7676 run : |
7777 git-ref
78+ git-ref --type
7879 REF=$(git-ref)
79- echo "Current ref: $REF" >> $GITHUB_STEP_SUMMARY
80+ echo "Current ref: $REF $TYPE " >> $GITHUB_STEP_SUMMARY
8081 if [[ "$REF" != "${{ github.sha }}" ]]; then
8182 echo "Output of git-ref script ($REF) does not match github.sha (${{ github.sha }})"
8283 exit 1;
Original file line number Diff line number Diff line change 2020## Scripts
2121- ` run-with-summary`: Runs a command and generates a markdown summary with output and execution details.
2222- `wait-for` : Runs a command repeatedly until it passes.
23+ - `git-ref` : Prints the branch or tag name of a git clone.
2324
2425# # Run With Summary
2526
@@ -96,6 +97,23 @@ wait-for curl https://deploy-url/ready
9697# SILENT: Set to 1 to not print any output except the timeout exceeded error. Useful when running from other scripts. See wait-mysql
9798```
9899
100+ ## `git-ref`
101+
102+ > Print the branch or tag name of the current directory of a cloned git repo. Use `--type` to show if it is a branch or tag.
103+
104+ ```
105+ git-ref [ OPTIONS]
106+
107+ Prints the branch or tag of the current git repository.
108+
109+ Options:
110+
111+ -t, --type Print the git reference type ('branch' or 'tag').
112+
113+ If PWD is tracking a branch, print "branch".
114+ If PWD is in a DETACHED HEAD state, and there is a tag for the SHA, print "tag".
115+ If the PWD is in a DETACHED HEAD state, and there is no tag, exit with an error.
116+ ```
99117
100118## History
101119
You can’t perform that action at this time.
0 commit comments