Group presentation for semidirect products

If $G$ and $H$ are groups with presentations $G=\langle X|R \rangle$ and $H=\langle Y| S \rangle$, then of course $G \times H$ has presentation $\langle X,Y | xy=yx \ \forall x \in X \ \text{and} \ y \in Y, R,S \rangle$. Given two group presentations $G=\langle X|R \rangle$ and $H=\langle Y| S \rangle$ and a homomorphism $\phi: H \rightarrow \operatorname{Aut}(G)$, what is a presentation for $G \rtimes H$? Is there a nice presentation, as in the direct product case? Thanks!

Let $G = \langle X \mid R\rangle$ and $H = \langle Y \mid S\rangle$, and let $\phi\colon H\to\mathrm{Aut}(G)$. Then the semidirect product $G\rtimes_\phi H$ has the following presentation: $$G\rtimes_\phi H \;=\; \langle X, Y \mid R,\,S,\,yxy^{-1}=\phi(y)(x)\text{ for all }x\in X\text{ and }y\in Y\rangle$$ Note that this specializes to the presentation of the direct product in the case where $\phi$ is trivial.

For example, let $G = \langle x \mid x^n = 1\rangle$ be a cyclic group of order $n$, let $H = \langle y \mid y^2=1\rangle$ be a cyclic group of order two, and let $\phi\colon H \to \mathrm{Aut}(G)$ be the homomorphism defined by $\phi(y)(x) = x^{-1}$. Then the semidirect product $G\rtimes_\phi H$ is the dihedral group of order $2n$, with presentation $$G\rtimes_\phi H \;=\; \langle x,y\mid x^n=1,y^2=1,yxy^{-1}=x^{-1}\rangle.$$