Fix error in WordPress Plugin Update workflow (#6441)
* Removing redirect property - Closes #6431 * Fix worflow error when updating WP Plugin template * update wordpress-plugins-update.ymlpatch-1
parent
79f04b4791
commit
631656eee2
|
@ -19,6 +19,7 @@ from bs4 import BeautifulSoup
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
import os
|
||||||
from termcolor import colored, cprint
|
from termcolor import colored, cprint
|
||||||
|
|
||||||
# Regex to extract the name of th plugin from the URL
|
# Regex to extract the name of th plugin from the URL
|
||||||
|
@ -158,14 +159,25 @@ requests:
|
||||||
regex:
|
regex:
|
||||||
- '(?i)Stable.tag:\s?([\w.]+)'
|
- '(?i)Stable.tag:\s?([\w.]+)'
|
||||||
'''
|
'''
|
||||||
version_file = open(
|
|
||||||
f"helpers/wordpress/plugins/{name}.txt", "w")
|
work_dir = os.getcwd()
|
||||||
|
print(f"Current working directory: {work_dir}")
|
||||||
|
helper_dir = f"{work_dir}/helpers/wordpress/plugins"
|
||||||
|
template_dir = f"{work_dir}/technologies/wordpress/plugins"
|
||||||
|
|
||||||
|
if not os.path.exists(helper_dir):
|
||||||
|
os.makedirs(helper_dir)
|
||||||
|
|
||||||
|
if not os.path.exists(template_dir):
|
||||||
|
os.makedirs(template_dir)
|
||||||
|
|
||||||
|
helper_path = f"helpers/wordpress/plugins/{name}.txt"
|
||||||
|
version_file = open(helper_path, "w")
|
||||||
version_file.write(version)
|
version_file.write(version)
|
||||||
version_file.close()
|
version_file.close()
|
||||||
|
|
||||||
# print(template)
|
template_path = f"technologies/wordpress/plugins/{name}.yaml"
|
||||||
template_file = open(
|
template_file = open(template_path, "w") # Dev environment
|
||||||
f"technologies/wordpress/plugins/{name}.yaml", "w")
|
|
||||||
template_file.write(template)
|
template_file.write(template)
|
||||||
template_file.close()
|
template_file.close()
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,6 @@ jobs:
|
||||||
Update:
|
Update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install tree
|
|
||||||
run: sudo apt-get install tree -y
|
|
||||||
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
@ -25,19 +22,21 @@ jobs:
|
||||||
pip install -r .github/scripts/wordpress-plugins-update-requirements.txt
|
pip install -r .github/scripts/wordpress-plugins-update-requirements.txt
|
||||||
|
|
||||||
- name: Update Templates
|
- name: Update Templates
|
||||||
|
id: update-templates
|
||||||
run: |
|
run: |
|
||||||
python3 .github/scripts/wordpress-plugins-update.py
|
python3 .github/scripts/wordpress-plugins-update.py
|
||||||
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
|
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Commit files
|
- name: Commit files
|
||||||
if: steps.readme-update.outputs.CHANGES > 0
|
if: steps.update-templates.outputs.CHANGES > 0
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "action@github.com"
|
git config --local user.email "action@github.com"
|
||||||
git config --local user.name "GitHub Action"
|
git config --local user.name "GitHub Action"
|
||||||
git commit -m "Auto WordPress Plugins Update [$(date)] :robot:" -a
|
git add --all
|
||||||
|
git commit -m "Auto WordPress Plugins Update [$(date)] :robot:"
|
||||||
|
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
if: steps.readme-update.outputs.CHANGES > 0
|
if: steps.update-templates.outputs.CHANGES > 0
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.TOKEN }}
|
github_token: ${{ secrets.TOKEN }}
|
||||||
|
|
Loading…
Reference in New Issue