That is his job but he also swore to protect the constitution from foreign and domestic enemies and in that sense he was doing his duty ensuring procedure would be followed when the sitting president was for all intent and purposes refusing to accept the election results. There is no case for treason against Miley.
Oath of Commissioned Officers
I ___, do solemnly swear (or affirm) that I will support and defend the Constitution of the United States against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same; that I take this obligation freely, without any mental reservation or purpose of evasion; and that I will well and faithfully discharge the duties of the office on which I am about to enter. So help me God. (Title 5 U.S. Code 3331, an individual, except the President, elected or appointed to an office of honor or profit in the civil service or uniformed services)
10 U.S. Code § 163 - Role of Chairman of Joint Chiefs of Staff
U.S. Code
prev | next
(a)Communications Through Chairman of JCS; Assignment of Duties.—Subject to the limitations in section 152(c) of this title, the President may—
(1)direct that communications between the President or the Secretary of Defense and the commanders of the unified and specified combatant commands be transmitted through the Chairman of the Joint Chiefs of Staff; and
(2)assign duties to the Chairman to assist the President and the Secretary of Defense in performing their command function.
(b)Oversight by Chairman of Joint Chiefs of Staff.—
(1)The Secretary of Defense may assign to the Chairman of the Joint Chiefs of Staff responsibility for overseeing the activities of the combatant commands. Such assignment by the Secretary to the Chairman does not confer any command authority on the Chairman and does not alter the responsibility of the commanders of the combatant commands prescribed in section 164(b)(2) of this title.
(2)Subject to the authority, direction, and control of the Secretary of Defense, the Chairman of the Joint Chiefs of Staff serves as the spokesman for the commanders of the combatant commands, especially on the operational requirements of their commands. In performing such function, the Chairman shall—
(A)confer with and obtain information from the commanders of the combatant commands with respect to the requirements of their commands;
(B)evaluate and integrate such information;
(C)advise and make recommendations to the Secretary of Defense with respect to the requirements of the combatant commands, individually and collectively; and
(D)communicate, as appropriate, the requirements of the combatant commands to other elements of the Department of Defense.
https://constitution.congress.gov/br...III_S3_C1_1_2/
ArtIII.S3.C1.1.2 Treason Clause: Doctrine and Practice
Article III, Section 3, Clause 1:
Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid and Comfort. No Person shall be convicted of Treason unless on the testimony of two Witnesses to the same overt Act, or on Confession in open Court.