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.yml
patch-1
Ricardo Maia 2022-12-29 05:34:11 -03:00 committed by GitHub
parent 79f04b4791
commit 631656eee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View File

@ -19,6 +19,7 @@ from bs4 import BeautifulSoup
import requests
import re
from markdown import markdown
import os
from termcolor import colored, cprint
# Regex to extract the name of th plugin from the URL
@ -158,14 +159,25 @@ requests:
regex:
- '(?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.close()
# print(template)
template_file = open(
f"technologies/wordpress/plugins/{name}.yaml", "w")
template_path = f"technologies/wordpress/plugins/{name}.yaml"
template_file = open(template_path, "w") # Dev environment
template_file.write(template)
template_file.close()

View File

@ -7,9 +7,6 @@ jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Install tree
run: sudo apt-get install tree -y
- name: Check out repository code
uses: actions/checkout@v3
with:
@ -25,19 +22,21 @@ jobs:
pip install -r .github/scripts/wordpress-plugins-update-requirements.txt
- name: Update Templates
id: update-templates
run: |
python3 .github/scripts/wordpress-plugins-update.py
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
- name: Commit files
if: steps.readme-update.outputs.CHANGES > 0
if: steps.update-templates.outputs.CHANGES > 0
run: |
git config --local user.email "action@github.com"
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
if: steps.readme-update.outputs.CHANGES > 0
if: steps.update-templates.outputs.CHANGES > 0
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TOKEN }}