-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (41 loc) · 1.25 KB
/
clone-post.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Clone Post
description: Clone WordPress post
inputs:
environment:
description: 'The deployment environment (QA, SBOX, PROD)'
required: true
postID:
description: 'The ID of the post to clone'
required: true
WORDPRESS_USERNAME:
description: 'WordPress Username'
required: true
WORDPRESS_PASSWORD:
description: 'WordPress Password'
required: true
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Run cloning script
run: |
python wordpress-cloning-script.py ${{ inputs.environment }} ${{ inputs.postID }} ${{ inputs.WORDPRESS_USERNAME }} ${{ inputs.WORDPRESS_PASSWORD }}
- name: Configure git user
run: |
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
- name: Commit and push changes
run: |
git add .
if git diff --staged --quiet; then
echo "No changes to commit."
else
git commit -m "Cloned WordPress post ${{ inputs.postID }} for environment ${{ inputs.environment }}"
git push