Skip to content

Commit 8728f91

Browse files
committed
Merge branch 'develop'
2 parents d98cd5b + a58046d commit 8728f91

File tree

5 files changed

+78
-27
lines changed

5 files changed

+78
-27
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Generate POT PR
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
10+
jobs:
11+
generate-pot:
12+
name: Generate POT PR
13+
if: github.repository == "${{ github.event.repository.full_name }}"
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out source code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up PHP environment
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: "7.4"
26+
27+
- name: Setup WP-CLI
28+
uses: godaddy-wordpress/setup-wp-cli@1
29+
30+
- name: Configure git user
31+
run: |
32+
git config --global user.email "[email protected]"
33+
git config --global user.name "Andy Fragen"
34+
35+
- name: Check if remote branch exists
36+
run: echo "REMOTE_BRANCH_EXISTS=$([[ -z $(git ls-remote --heads origin generate-pot) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
37+
38+
- name: Create branch to base pull request on
39+
if: env.REMOTE_BRANCH_EXISTS == 0
40+
run: |
41+
git checkout -b generate-pot
42+
43+
- name: Fetch existing branch to add commits to
44+
if: env.REMOTE_BRANCH_EXISTS == 1
45+
run: |
46+
git fetch --all --prune
47+
git checkout generate-pot
48+
git pull --no-rebase
49+
50+
- name: Generate POT
51+
run: |
52+
wp i18n make-pot . "./languages/${{ github.event.repository.name }}.pot" --headers='{"Report-Msgid-Bugs-To":"https://github.com/${{ github.event.repository.full_name }}/issues"}'
53+
54+
- name: Check if there are changes
55+
run: echo "CHANGES_DETECTED=$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
56+
57+
- name: Commit changes
58+
if: env.CHANGES_DETECTED == 1
59+
run: |
60+
git add "./languages/${{ github.event.repository.name }}.pot"
61+
git commit -m "Generate POT - $(date +'%Y-%m-%d')"
62+
git push origin generate-pot
63+
64+
- name: Create pull request
65+
if: env.CHANGES_DETECTED == 1
66+
run: gh pr create --base main --head generate-pot --title "Generate POT - $(date +'%Y-%m-%d')" --body "Automated PR"
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/generate-pot.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

CHANGES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[unreleased]
22

3-
#### 2.4.0 /2024-12-30
3+
#### 2.4.1 / 2025-01-02
4+
* update `GitLab_API::parse_asset_dir_response`
5+
6+
#### 2.4.0 / 2024-12-30
47
* update for checking contents, assets, changes, and readmes
58

69
#### 2.3.2 / 2024-12-26

git-updater-gitlab.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Plugin Name: Git Updater - GitLab
1414
* Plugin URI: https://github.com/afragen/git-updater-gitlab
1515
* Description: Add GitLab hosted repositories to the Git Updater plugin.
16-
* Version: 2.4.0
16+
* Version: 2.4.1
1717
* Author: Andy Fragen
1818
* License: MIT
1919
* Network: true

src/GitLab/GitLab_API.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ protected function parse_asset_dir_response( $response ) {
491491
$assets[ $asset->name ] = $asset->download_url;
492492
}
493493

494+
if ( empty( $assets ) ) {
495+
$assets['message'] = 'No assets found';
496+
$assets = (object) $assets;
497+
}
498+
494499
return $assets;
495500
}
496501

0 commit comments

Comments
 (0)