-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Namith Jawahar <[email protected]>
- Loading branch information
Showing
43 changed files
with
3,821 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Generate POT PR | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
generate-pot: | ||
name: Generate POT PR | ||
if: github.repository == 'aspirepress/aspireupdate' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP environment | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.4" | ||
|
||
- name: Setup WP-CLI | ||
uses: godaddy-wordpress/setup-wp-cli@1 | ||
|
||
- name: Configure git user | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Andy Fragen" | ||
- name: Check if remote branch exists | ||
run: echo "REMOTE_BRANCH_EXISTS=$([[ -z $(git ls-remote --heads origin generate-pot) ]] && echo "0" || echo "1")" >> $GITHUB_ENV | ||
|
||
- name: Create branch to base pull request on | ||
if: env.REMOTE_BRANCH_EXISTS == 0 | ||
run: | | ||
git checkout -b generate-pot | ||
- name: Fetch existing branch to add commits to | ||
if: env.REMOTE_BRANCH_EXISTS == 1 | ||
run: | | ||
git fetch --all --prune | ||
git checkout generate-pot | ||
git pull --no-rebase | ||
- name: Generate POT | ||
run: | | ||
wp i18n make-pot . "./languages/${{ github.event.repository.name }}.pot" --headers='{"Report-Msgid-Bugs-To":"https://github.com/${{ github.event.repository.full_name }}/issues"}' | ||
- name: Check if there are changes | ||
run: echo "CHANGES_DETECTED=$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")" >> $GITHUB_ENV | ||
|
||
- name: Commit changes | ||
if: env.CHANGES_DETECTED == 1 | ||
run: | | ||
git add "./languages/${{ github.event.repository.name }}.pot" | ||
git commit -m "Generate POT - $(date +'%Y-%m-%d')" | ||
git push origin generate-pot | ||
- name: Create pull request | ||
if: env.CHANGES_DETECTED == 1 | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
source_branch: generate-pot | ||
destination_branch: ${{ github.event.repository.default_branch }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: Generate POT | ||
pr_body: "This is an automated pull-request" |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Abstract base test class for \AspireUpdate\Admin_Settings. | ||
* | ||
* All \AspireUpdate\Admin_Settings unit tests should inherit from this class. | ||
*/ | ||
abstract class AdminSettings_UnitTestCase extends WP_UnitTestCase { | ||
/** | ||
* The Name of the Option. | ||
* | ||
* @var string | ||
*/ | ||
protected static $option_name = 'aspireupdate_settings'; | ||
|
||
/** | ||
* The Slug of the Option's page. | ||
* | ||
* @var string | ||
*/ | ||
protected static $options_page = 'aspireupdate-settings'; | ||
|
||
/** | ||
* Deletes settings before each test runs. | ||
* | ||
* @return void | ||
*/ | ||
public function set_up() { | ||
parent::set_up(); | ||
|
||
delete_site_option( self::$option_name ); | ||
} | ||
} |
Oops, something went wrong.