-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (73 loc) · 2.57 KB
/
Copy pathupdate-readme.yml
File metadata and controls
80 lines (73 loc) · 2.57 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Update README.md (v4)
#
# Previous (v3): ran on every push to main regardless of whether composer.lock
# changed, and wget'd update-readme.sh from the v3 branch at run time.
#
# Next (v4): the script is bundled in the update-readme composite action.
# Callers should gate this workflow on composer.lock actually changing, e.g.:
# if: contains(toJSON(github.event.commits.*.modified), 'composer.lock')
name: Update README.md
on:
workflow_call:
inputs:
base:
description: "Where the branch is based from. Typically release please"
required: false
default: "release-please--branches--main"
type: string
branch:
description: "What branch do we create when updating the readme"
required: false
default: "release-please--branches--main--readme"
type: string
secrets:
GH_BOT_TOKEN:
description: "Token used to open the README update PR"
required: true
permissions:
contents: write
pull-requests: write
jobs:
update-readme:
name: Update Readme
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Checkout just the files the script reads/writes
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ inputs.base }}
sparse-checkout: |
README.md
composer.lock
sparse-checkout-cone-mode: false
- name: Update README.md from composer.lock
uses: linchpin/actions/actions/update-readme@v4
- name: Commit changes to README.md
id: commit_changes
run: |
git config --local user.email "linchpin-bot@github.com"
git config --local user.name "Linchpin Bot"
git add README.md
if git diff --cached --quiet; then
echo "No changes to commit"
echo "skip_pr=true" >> "$GITHUB_OUTPUT"
else
git commit -m "Update README.md with plugin list"
echo "skip_pr=false" >> "$GITHUB_OUTPUT"
fi
- name: Create or Update Pull Request
if: ${{ steps.commit_changes.outputs.skip_pr == 'false' }}
uses: peter-evans/create-pull-request@v8
with:
commit-message: "[automated] Update Plugin List"
title: "[Maintenance] Update README.md WordPress Plugin List"
body: "Automated update of the README plugin/theme table from composer.lock."
base: ${{ inputs.base }}
branch: ${{ inputs.branch }}
labels: |
wordpress
automated pr
maintenance
token: ${{ secrets.GH_BOT_TOKEN }}