Correct. Never work in branch gh-pages only in sub-branches that want to merge in the main branch and the workflow must pushed in the main-branch in .github/workflows as main.yml
And I’ve forgotten to write. You need an app_token. this you can create in Settings > Developer settings > Personal access tokens (classic)
Here you need to create a new repository token ( Generate new token (classic) )
This token you must copy and integrate in your repository.
Repository > Settings > Secrets and variables > Actions > Repository secrets
Add new and name it “APP_TOKEN” and paste your token which you have copied.