Skip to content

Commit e71d9a3

Browse files
committed
feat: wp-composer compatibility
1 parent 3e58c28 commit e71d9a3

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/composer-lock-diff.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,28 @@ jobs:
2828
with-links: true
2929
with-licenses: true
3030

31-
- name: Check for WPackagist changes
32-
if: ${{ hashFiles('wp-cli.yml') != '' }} # Only run if wp-cli.yml exists
33-
uses: roots/wpackagist-changelog-action@v1
31+
- name: Detect WP Composer Repository (WPackagist or WP Composer)
32+
id: detect_repo
33+
run: |
34+
if grep -q 'repo\.wp-composer\.com' composer.json; then
35+
echo "action=roots/wp-composer-changelog-action@v2" >> $GITHUB_OUTPUT
36+
elif grep -q 'wpackagist\.org' composer.json; then
37+
echo "action=roots/wp-composer-changelog-action@v1" >> $GITHUB_OUTPUT
38+
else
39+
echo "action=" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: WPackagist Changelog
43+
if: ${{ steps.detect_repo.outputs.action == 'roots/wp-composer-changelog-action@v1' && hashFiles('wp-cli.yml') != '' }} # Only run if a matching repo is detected and wp-cli.yml file exists
44+
uses: roots/wp-composer-changelog-action@v1
45+
with:
46+
token: ${{ secrets.YARD_BOT_PAT || secrets.GITHUB_TOKEN }}
47+
48+
- name: WP Composer Changelog
49+
if: ${{ steps.detect_repo.outputs.action == 'roots/wp-composer-changelog-action@v2' && hashFiles('wp-cli.yml') != '' }} # Only run if a matching repo is detected and wp-cli.yml file exists
50+
uses: ${{ steps.detect_repo.outputs.action }}
3451
with:
35-
token: ${{ secrets.YARD_BOT_PAT }}
52+
token: ${{ secrets.YARD_BOT_PAT || secrets.GITHUB_TOKEN }}
3653

3754
- uses: marocchino/sticky-pull-request-comment@v2
3855
# An empty diff result will break this action.

0 commit comments

Comments
 (0)