From 311c0904fafbdb74d0699e926ea2a54b8f717cf6 Mon Sep 17 00:00:00 2001
From: Matthias Mair <code@mjmair.com>
Date: Sun, 29 Jan 2023 21:18:40 +0100
Subject: [PATCH] Fix action ref (#115)

* add debug line

* add token

* remove old token ref

* move permission section

* clean inputs
---
 .github/collect_plugin.py            | 5 +++--
 .github/workflows/collect_plugin.yml | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/.github/collect_plugin.py b/.github/collect_plugin.py
index 33103b79..3e9122a6 100644
--- a/.github/collect_plugin.py
+++ b/.github/collect_plugin.py
@@ -3,11 +3,12 @@ import os
 from pathlib import Path
 from urllib.request import urlopen, Request
 
-inp_project = os.environ.get('PROJECT')
-inp_author = os.environ.get('AUTHOR')
+inp_project = os.environ.get('PROJECT').strip()
+inp_author = os.environ.get('AUTHOR').strip()
 file_name = Path(f'_repo/{inp_project}.md')
 crowdin_projet_id = 452300
 
+print(f'Collecting {inp_project} with {inp_author}...')
 
 def get_data(url, key=None, default=0, auth=None):
   """Fetches data from remote endpoint"""
diff --git a/.github/workflows/collect_plugin.yml b/.github/workflows/collect_plugin.yml
index 4060083f..5fdc7390 100644
--- a/.github/workflows/collect_plugin.yml
+++ b/.github/workflows/collect_plugin.yml
@@ -13,11 +13,11 @@ jobs:
   build:
 
     runs-on: ubuntu-latest
-    permissions: {}
+    permissions:
+      contents: write
+      pull-requests: write
     steps:
       - uses: actions/checkout@v2
-        with:
-         token: ${{ secrets.BOT_PAT }}
       - name: Get Plugin file
         run: python .github/collect_plugin.py
         env:
@@ -26,6 +26,7 @@ jobs:
       - name: Create Pull Request
         uses: peter-evans/create-pull-request@v4
         with:
+          token: ${{ secrets.GITHUB_TOKEN }}
           commit-message: "[REPO] Add plugin ${{ github.event.inputs.project }}"
           branch: "plugin/${{ github.event.inputs.project }}"
           title: "[REPO] Add plugin ${{ github.event.inputs.project }}"