"I said "goodbye" while I was leaving."
Translation:Giderken "hoşça kal" dedim.
I agree that you will usually take the subject (and often tense) of the -(y)ken clause from the context in the main clause. Here, your main verb is "dedim" - so you will assume your subject in both clauses is "I" (and past tense).
We were taught early in the lessons that if the sentence has multiple subjects, you need to use both pronouns. But I don't know whether that rule applies when you have relative clauses instead of separate clauses. I would try:
Sen giderken ben "güle güle" dedim.
(You say "stay pleasantly" to the person staying, and "go laughing" to the person going.)