From fe907673b448e492566bcf0efa242a7f3d83ddff Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Sun, 11 Feb 2024 20:26:25 +0100 Subject: [PATCH] ci: fix issues in POT script --- .github/helper/update_pot_file.sh | 24 ++++++++++++++++++++---- .github/workflows/generate-pot-file.yml | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/helper/update_pot_file.sh b/.github/helper/update_pot_file.sh index ede2186e50..6a472f9f93 100644 --- a/.github/helper/update_pot_file.sh +++ b/.github/helper/update_pot_file.sh @@ -5,17 +5,33 @@ cd ~ || exit echo "Setting Up Bench..." pip install frappe-bench -bench -v init frappe-bench --skip-assets --python "$(which python)" --frappe-path "${GITHUB_WORKSPACE}" +bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)" --frappe-path "${GITHUB_WORKSPACE}" cd ./frappe-bench || exit echo "Generating POT file..." bench generate-pot-file --app frappe +cd ./apps/frappe || exit + +echo "Configuring git user..." +git config user.email "developers@erpnext.com" +git config user.name "frappe-pr-bot" + +echo "Setting the correct git remote..." +# Here, the git remote is a local file path by default. Let's change it to the upstream repo. +git remote set-url upstream https://github.com/frappe/frappe.git + +echo "Creating a new branch..." +isodate=$(date -u +"%Y-%m-%d") +branch_name="pot_${BASE_BRANCH}_${isodate}" +git checkout -b "${branch_name}" + echo "Commiting changes..." -cd "${GITHUB_WORKSPACE}" -git checkout -b update-pot-file git add . git commit -m "chore: update POT file" +gh auth setup-git +git push -u upstream "${branch_name}" + echo "Creating a PR..." -gh pr create --base "${BRANCH}" --head update-pot-file +gh pr create --fill --base "${BASE_BRANCH}" --head "${branch_name}" -R frappe/frappe diff --git a/.github/workflows/generate-pot-file.yml b/.github/workflows/generate-pot-file.yml index 83f9d1314a..b565461ffe 100644 --- a/.github/workflows/generate-pot-file.yml +++ b/.github/workflows/generate-pot-file.yml @@ -35,4 +35,4 @@ jobs: bash ${GITHUB_WORKSPACE}/.github/helper/update_pot_file.sh env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: ${{ matrix.branch }} + BASE_BRANCH: ${{ matrix.branch }}