Run PHP script #412
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
name: Run PHP script | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
EXPIRATION_LIMIT: 7 | |
DOMAINS: 'dpe.ac,dpedu.ir,dpgoal.com,dpmaharat.com,borhanbs.ir,danesh-online.com,ava-crm.ir,darkoobjob.ir,mettis.ir,liaan.ir' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: Run script | |
run: | | |
echo "$(php check.php)" > output.txt | |
echo "RESULT<<EOF" >> $GITHUB_ENV | |
cat output.txt >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Commit and push if it changed | |
run: | | |
git diff | |
git config --global user.email "action@github.com" | |
git config --global user.name "GitHub Action" | |
git commit -am "Update README.md" || exit 0 | |
git push | |
- name: Send mail | |
uses: dawidd6/action-send-mail@v3 | |
if: contains(env.RESULT, 'expired') | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
username: ${{secrets.MAIL_USERNAME}} | |
password: ${{secrets.MAIL_PASSWORD}} | |
subject: SSL Certificate Expiry | |
html_body: file://output.txt | |
convert_markdown: true | |
to: ${{secrets.MAIL_USERNAME}} | |
from: Github Action <${{secrets.MAIL_USERNAME}}> |