Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- name: Check out repo
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

- name: Verify checked-out branch
run: |
echo "Checked out branch: $(git rev-parse --abbrev-ref HEAD)"

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
Expand Down
25 changes: 25 additions & 0 deletions code/+matbox/+git/deleteGitTag.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function deleteGitTag(tagName, projectDirectory)
% deleteGitTag - Delete tag from repository (local and remotely)
%

arguments
tagName (1,1) string
projectDirectory (1,1) string {mustBeFolder} = pwd

Check warning on line 7 in code/+matbox/+git/deleteGitTag.m

View check run for this annotation

Codecov / codecov/patch

code/+matbox/+git/deleteGitTag.m#L7

Added line #L7 was not covered by tests
end

if ~strcmp(pwd, projectDirectory)
currentWorkingDir = pwd;
cleanupObj = onCleanup(@(fn) cd(currentWorkingDir));
cd(projectDirectory)

Check warning on line 13 in code/+matbox/+git/deleteGitTag.m

View check run for this annotation

Codecov / codecov/patch

code/+matbox/+git/deleteGitTag.m#L10-L13

Added lines #L10 - L13 were not covered by tests
end

%[s,m] = system( '$(git rev-parse --abbrev-ref HEAD) == "main"' )

[s1, m1] = system(sprintf("git tag --delete %s", tagName));
assert(s1==0, 'MATBOX:GitUtility:DeleteTagFailed', ...
'Failed to delete local tag. Reason: %s', m1);

Check warning on line 20 in code/+matbox/+git/deleteGitTag.m

View check run for this annotation

Codecov / codecov/patch

code/+matbox/+git/deleteGitTag.m#L18-L20

Added lines #L18 - L20 were not covered by tests

[s2, m2] = system(sprintf("git push --delete origin %s", tagName));
assert(s2==0, 'MATBOX:GitUtility:DeleteTagFailed', ...
'Failed to delete remote tag. Reason: %s', m2);

Check warning on line 24 in code/+matbox/+git/deleteGitTag.m

View check run for this annotation

Codecov / codecov/patch

code/+matbox/+git/deleteGitTag.m#L22-L24

Added lines #L22 - L24 were not covered by tests
end