Skip to content

Commit

Permalink
ci: oops
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbocanegra committed Jan 15, 2025
1 parent 64435fe commit 1db1897
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/merge-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
permissions:
contents: write
pull-requests: write
checks: read
statuses: read

# private repos
# actions: read
# repository-projects: read

name: action-merge-translations

Expand All @@ -22,10 +28,17 @@ jobs:

- name: Install gettext
run: sudo apt-get install gettext

- name: Set vars
run: |
echo "BRANCH=action-merge-translations" >> $GITHUB_ENV
echo "TITLE='Merge translations'" >> $GITHUB_ENV
echo "BODY='This PR was created by GitHub Actions'" >> $GITHUB_ENV
- name: Branch
run: |
git checkout -b action-merge-translations
git branch -D "${{ env.BRANCH }}" || true
git checkout -b "${{ env.BRANCH }}"
- name: Merge translations
run: python ./kpac i18n
Expand All @@ -48,12 +61,18 @@ jobs:
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add .
git commit -m "Merge translations"
git push origin action-merge-translations -f
git commit -m "${{ env.TITLE }}"
git push origin "${{ env.BRANCH }}" -f
- name: Create Pull Request
if: steps.check_changes.outputs.is_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ env.BRANCH_NAME }} -b '${{ env.PR_BODY }}' -t '${{ env.PR_TITLE }}' && gh pr reopen ${{ env.BRANCH_NAME }} || gh pr create --fill -B main -H ${{ env.BRANCH_NAME }} --title "Merge translations" --body "This PR was created by GitHub Actions"
PR_URL="$(gh pr list --head "${{ env.BRANCH }}" --state open --json url --jq .[].url)"
if [[ -n "${PR_URL}" ]]; then
echo "PR already exists -> ${PR_URL}"
gh pr edit "${{ env.BRANCH }}" -t "${{ env.TITLE }}" -b "${{ env.BODY }}"
else
gh pr create -B main -H "${{ env.BRANCH }}" -t "${{ env.TITLE }}" -b "${{ env.BODY }}"
fi

0 comments on commit 1db1897

Please sign in to comment.