V 2.0 Source.

main
Varun 3 years ago
parent c1c0b55c15
commit fbd60e06b1
No known key found for this signature in database
GPG Key ID: 93FB46DCF16E0D6F

@ -1,11 +1,11 @@
FROM php:zts-alpine3.11
RUN apk add git
FROM varunsridharan/actions-alpine-php:latest
COPY entrypoint.sh /entrypoint.sh
COPY add-textdomain.php /add-textdomain.php
RUN chmod +x /entrypoint.sh
RUN chmod +x /add-textdomain.php
RUN chmod 777 /entrypoint.sh
RUN chmod 777 /add-textdomain.php
ENTRYPOINT ["/entrypoint.sh"]

@ -1,61 +1,103 @@
<p align="center"><img src="https://cdn.svarun.dev/gh/actions-small.png" width="150px"/></p>
# WP Text Domain - ***Github Action***
This Action Adds TextDomain To your wordpress Plugin / Theme based on the content inside Github Repo
## Configuration
* `domain` - Slug of your WordPress Theme / Plugin Slug **Required**
* `path` - Location where to search for `*.php` files and update textdomain
* `GITHUB_TOKEN` - you do not need to generate one but you do have to explicitly make it available to the Action
> **⚠️ Note:** You Should Provide Github Token. If Not Updated File Will Be Committed & Pushed.
## Example Workflow File
<!-- START RAW -->
```yaml
name: On Push
on:
push:
branches:
- master
- main
jobs:
WP_Text_Domain:
wp_textdomain_updater:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: WordPress Textdomain
uses: varunsridharan/action-wp-textdomain@1.1
uses: varunsridharan/action-wp-textdomain@2.0
with:
domain: '{your-text-domain}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
<!-- END RAW -->
---
## Contribute
If you would like to help, please take a look at the list of
[issues][issues] or the [To Do](#-todo) checklist.
## License
Our GitHub Actions are available for use and remix under the MIT license.
<!-- START common-footer.mustache -->
## 📝 Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
[Checkout CHANGELOG.md](https://github.com/varunsridharan/action-wp-textdomain/blob/main/CHANGELOG.md)
## 🤝 Contributing
If you would like to help, please take a look at the list of [issues](https://github.com/varunsridharan/action-wp-textdomain/issues/).
## 📜 License & Conduct
- [**MIT License**](https://github.com/varunsridharan/action-wp-textdomain/blob/main/LICENSE) © [Varun Sridharan](website)
- [Code of Conduct](https://github.com/varunsridharan/.github/blob/master/CODE_OF_CONDUCT.md)
## 📣 Feedback
- ⭐ This repository if this project helped you! :wink:
- Create An [🔧 Issue](https://github.com/varunsridharan/action-wp-textdomain/issues/) if you need help / found a bug
## Copyright
2017 - 2018 Varun Sridharan, [varunsridharan.in][website]
If you find it useful, let me know :wink:
## 💰 Sponsor
[I][twitter] fell in love with open-source in 2013 and there has been no looking back since! You can read more about me [here][website].
If you, or your company, use any of my projects or like what Im doing, kindly consider backing me. I'm in this for the long run.
You can contact me on [Twitter][twitter] or through my [email][email].
- ☕ How about we get to know each other over coffee? Buy me a cup for just [**$9.99**][buymeacoffee]
- ☕️☕️ How about buying me just 2 cups of coffee each month? You can do that for as little as [**$9.99**][buymeacoffee]
- 🔰 We love bettering open-source projects. Support 1-hour of open-source maintenance for [**$24.99 one-time?**][paypal]
- 🚀 Love open-source tools? Me too! How about supporting one hour of open-source development for just [**$49.99 one-time ?**][paypal]
## Backed By
| [![DigitalOcean][do-image]][do-ref] | [![JetBrains][jb-image]][jb-ref] | [![Tidio Chat][tidio-image]][tidio-ref] |
| --- | --- | --- |
<!-- Personl Links -->
[paypal]: https://sva.onl/paypal
[buymeacoffee]: https://sva.onl/buymeacoffee
[twitter]: https://sva.onl/twitter/
[website]: https://sva.onl/website/
## Connect & Say 👋
- **Follow** me on [👨‍💻 Github][github] and stay updated on free and open-source software
- **Follow** me on [🐦 Twitter][twitter] to get updates on my latest open source projects
- **Message** me on [📠 Telegram][telegram]
- **Follow** my pet on [Instagram][sofythelabrador] for some _dog-tastic_ updates!
<!-- Personl Links -->
[sofythelabrador]: https://www.instagram.com/sofythelabrador/
[github]: https://sva.onl/github/
[twitter]: https://sva.onl/twitter/
[telegram]: https://sva.onl/telegram/
---
<p align="center">
<i>Built With ♥ By <a href="https://sva.onl/twitter" target="_blank" rel="noopener noreferrer">Varun Sridharan</a> <a href="https://en.wikipedia.org/wiki/India">
<img src="https://cdn.svarun.dev/flag-india.jpg" width="20px"/></a> </i> <br/><br/>
<img src="https://cdn.svarun.dev/codeispoetry.png"/>
</p>
---
[twitter]: https://twitter.com/varunsridharan2
[email]: mailto:varunsridharan23@gmail.com
[website]: https://varunsridharan.in
[issues]: issues/
[do-image]: https://vsp.ams3.cdn.digitaloceanspaces.com/cdn/DO_Logo_Horizontal_Blue-small.png
[jb-image]: https://vsp.ams3.cdn.digitaloceanspaces.com/cdn/phpstorm-small.png?v3
[tidio-image]: https://vsp.ams3.cdn.digitaloceanspaces.com/cdn/tidiochat-small.png
[do-ref]: https://s.svarun.in/Ef
[jb-ref]: https://www.jetbrains.com
[tidio-ref]: https://tidiochat.com
<!-- END common-footer.mustache -->

@ -1,16 +1,26 @@
name: 'WP Textdomain'
description: 'Adds TextDomain To your wordpress Plugin / Theme based on the content inside Github Repo'
name: 'Text Domain Updater For WordPress'
description: 'Adds TextDomain To your wordpress Plugin / Theme based on the content inside Github Repository'
author: 'varunsridharan'
branding:
icon: 'message-square'
color: 'gray-dark'
inputs:
path:
description: 'Set Custom Path There Files Needs To Be Updated'
required: false
default: './'
domain:
description: 'WordPress Theme / Plugin TextDomain'
description: 'WordPress Theme / Plugin Text-Domain'
required: true
default: ''
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.domain }}
- ${{ inputs.path }}

@ -2,26 +2,27 @@
set -eu
BRANCH=${GITHUB_REF#refs/heads/}
DOMAIN="$INPUT_DOMAIN"
source /gh-toolkit/shell.sh
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "Set the GITHUB_TOKEN env variable"
exit 1
fi
echo " "
echo "##[group] 💬 Updating Textdomain : $DOMAIN"
php /add-textdomain.php -i "$DOMAIN" "$GITHUB_WORKSPACE"
echo "##[endgroup]"
echo " "
gh_validate_env "GITHUB_TOKEN" "SET GITHUB_TOKEN ENV Variable"
gh_validate_input "DOMAIN" "Textdomain Is Not SET !"
gitconfig "WordPress Bot" "githubactionbot+wp@gmail.com"
DOMAIN="$(gh_input "DOMAIN")"
LOCAL_PATH="$(gh_input "PATH")"
gh_log ""
gh_log_group_start "💬 Updating Textdomain : $DOMAIN"
php /add-textdomain.php -i "$DOMAIN" "${GITHUB_WORKSPACE}/${LOCAL_PATH}"
gh_log_group_end
if [[ "$(git status --porcelain)" != "" ]]; then
echo "##[group] 👌 Pushing To Github"
git config --global user.email "githubactionbot+wp@gmail.com" && git config --global user.name "WP Textdomain Github Bot"
if [ "$(git status --porcelain)" != "" ]; then
gh_log_group_start "👌 Pushing To Github"
git add -A
git commit -m "💬 #$GITHUB_RUN_NUMBER - WP Textdomain Updated / ⚡ Triggered By $GITHUB_SHA"
git push "https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY" HEAD:$BRANCH
echo "##[endgroup]"
git commit -m "💬 Text Domain Updated"
git push "https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY"
gh_log_group_end
else
echo "✅ Nothing To Push"
fi

Loading…
Cancel
Save