Considering the below pages from the handbook sources I have, I have to say this sounds possible; though I didn't believe it at first.
Making an Attack: PHB pg 194
Choose a target: Pick a target from within your attack's range: A creature, an object, or location...
Resolve the Attack: You make an Attack Roll
First and foremost, you MUST make an attack roll. There are no sources to cite from either the PHB or the DMG that make exceptions to this rule. The recipient of any attack; melee weapon, ranged weapon, or spell attacks; does not have the option of getting hit without making the attacker roll first to get past armor class.
Now that we've dealt with that ... to make a melee attack you must choose 'A Creature within range' and since you are within your own range and count as a creature, you are a legal target for your own melee attack, unless the ability or spell says that you must target a HOSTILE creature. Making a general weapon attack does not carry that stipulation with it.
Green-Flame Blade is actually a spell with a range of 5ft that includes a melee weapon attack as part of the spell, and that it must be "A melee attack with a weapon against one creature within the spell's range.."
PHB page 204:
Targeting Yourself: If a spell targets a creature of your choice, you can choose yourself, unless the creature must be hostile or specifically a creature other than you.
So it seems that this cantrip can be targeted on yourself, AND the melee weapon attack that you must make as part of casting it can also target yourself, all under cited RAW.
The only two things you must overcome to successfully do this is first beating your own AC (Armor Class) with an attack roll as per PHB pg 194: 'Resolve the Attack', and second; surviving whatever damage your melee weapon attack roll does to yourself (and the damage of this melee attack get's stronger as your cantrip scales in power with your character level). So it's not an effective way to get an automatic, no-roll hit on an enemy.