I am trying to write a workflow that will automaticlly merge pull-requests to a public repository on github.
Here is the workflow:
<code>name: X
on:
pull_request:
paths:
- '<path>'
jobs:
Y:
runs-on: ubuntu-latest
permissions:
contents: write
env:
Approve: true
ADDED_FILES_COUNT: ""
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
</code>
<code>name: X
on:
pull_request:
paths:
- '<path>'
jobs:
Y:
runs-on: ubuntu-latest
permissions:
contents: write
env:
Approve: true
ADDED_FILES_COUNT: ""
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
</code>
name: X
on:
pull_request:
paths:
- '<path>'
jobs:
Y:
runs-on: ubuntu-latest
permissions:
contents: write
env:
Approve: true
ADDED_FILES_COUNT: ""
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
Notice i change the premissions on contents to write.
Still, looking at the run on github actions the presmission is set to read:
As result, when automerge is called an error message is shown and merging fails:
Important to say, I already changed the project settings to those:
why it is happening? is PAT a must in this case?
Thank you.