Skip to content

Commit

Permalink
chore: align with PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
luislard committed Feb 6, 2025
1 parent 8a34ccb commit 3a6d55d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update WordPress JS Dependencies Orchestrator
on:
workflow_call:
inputs:
WP_SCRIPT_DIST_TAG:
WP_DIST_TAG:
description: The dist-tag to update the dependencies to, e.g., `wp-6.7`
required: true
type: string
Expand All @@ -11,17 +11,17 @@ on:
required: false
type: string
secrets:
GH_API_TOKEN:
description: An GH API Token capable of triggering repository_dispatch.
GH_TOKEN:
description: A personal access token (classic) with `repo` and `workflow` permissions, used to authenticate when calling GitHub APIs in target repositories.
required: true

jobs:
update-dependencies-orchestrator:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}
WP_SCRIPT_DIST_TAG: ${{ inputs.WP_SCRIPT_DIST_TAG }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
WP_DIST_TAG: ${{ inputs.WP_DIST_TAG }}
PACKAGES: ${{ inputs.PACKAGES }}

steps:
Expand Down Expand Up @@ -57,8 +57,8 @@ jobs:
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ env.GH_API_TOKEN }}" \
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$package/dispatches \
-d '{"event_type":"update_wp_dependencies","client_payload":{"wp_version":"${{ env.WP_SCRIPT_DIST_TAG }}"}}'
-d '{"event_type":"update_wp_dependencies","client_payload":{"wp_version":"${{ env.WP_DIST_TAG }}"}}'
done
12 changes: 6 additions & 6 deletions .github/workflows/update-wordpress-js-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update WordPress JS Dependencies
on:
workflow_call:
inputs:
WP_SCRIPT_DIST_TAG:
WP_DIST_TAG:
description: The dist-tag to update the dependencies to, e.g., `wp-6.7`
required: true
type: string
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }}
GITHUB_USER_SSH_KEY: ${{ secrets.GITHUB_USER_SSH_KEY }}
GITHUB_USER_SSH_PUBLIC_KEY: ${{ secrets.GITHUB_USER_SSH_PUBLIC_KEY }}
WP_SCRIPT_DIST_TAG: ${{ github.event.client_payload.wp_version || inputs.WP_SCRIPT_DIST_TAG }}
WP_DIST_TAG: ${{ github.event.client_payload.wp_version || inputs.WP_DIST_TAG }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
NPM_REGISTRY_DOMAIN: ${{ inputs.NPM_REGISTRY_DOMAIN }}

Expand All @@ -51,7 +51,7 @@ jobs:

- name: Set global variables
run: |
echo "TEMP_BRANCH_NAME=update/${{ env.WP_SCRIPT_DIST_TAG }}" >> $GITHUB_ENV
echo "TEMP_BRANCH_NAME=update/${{ env.WP_DIST_TAG }}" >> $GITHUB_ENV
echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set up SSH
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
env:
SCRIPT_START: ${{ env.PACKAGE_MANAGER == 'npm' && 'npm run' }}
run: |
./node_modules/.bin/wp-scripts packages-update --dist-tag=${{ env.WP_SCRIPT_DIST_TAG }}
./node_modules/.bin/wp-scripts packages-update --dist-tag=${{ env.WP_DIST_TAG }}
- name: Git add, commit
run: |
Expand All @@ -124,8 +124,8 @@ jobs:
gh pr create \
--base ${{ github.event.repository.default_branch }} \
--head ${{ env.TEMP_BRANCH_NAME }} \
--title "Align WP Dependencies to meet dist tag ${{ env.WP_SCRIPT_DIST_TAG }} - ${{ env.CURRENT_DATE }}" \
--body "This PR updates the WordPress dependencies to meet the version ${{ env.WP_SCRIPT_DIST_TAG }}." \
--title "Align WP Dependencies to meet dist tag ${{ env.WP_DIST_TAG }} - ${{ env.CURRENT_DATE }}" \
--body "This PR updates the WordPress dependencies to meet the version ${{ env.WP_DIST_TAG }}." \
--label "dependencies"
- name: Delete signing key files
Expand Down
16 changes: 8 additions & 8 deletions docs/update-wp-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WordPress version tag (e.g., `wp-6.7`) and creates a pull request containing all

| Name | Default | Description |
|-----------------------|---------------------------------|-------------------------------------------------------|
| `WP_VERSION` | `'wp-6.7'` | The tag to update the dependencies to, e.g., `wp-6.7` |
| `WP_DIST_TAG` | `'wp-6.7'` | The tag to update the dependencies to, e.g., `wp-6.7` |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |

#### Secrets
Expand All @@ -51,7 +51,7 @@ name: Update WordPress JS Dependencies
on:
workflow_dispatch:
inputs:
WP_VERSION:
WP_DIST_TAG:
description: 'The tag to update the dependencies to, e.g., `wp-6.7`.'
default: 'wp-6.7'
required: true
Expand All @@ -69,7 +69,7 @@ jobs:
GITHUB_USER_SSH_PUBLIC_KEY: ${{ secrets.DEPLOYBOT_SSH_PUBLIC_KEY }}
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN }}
with:
WP_VERSION: ${{ inputs.WP_VERSION }}
WP_DIST_TAG: ${{ inputs.WP_DIST_TAG }}
```
## Update WordPress JS Dependencies Orchestrator Workflow
Expand All @@ -84,14 +84,14 @@ maintain a centralized list of repositories needing consistent WordPress JS depe

| Name | Default | Description |
|--------------|------------|----------------------------------------------------------------|
| `WP_VERSION` | `'wp-6.7'` | The tag to update the dependencies to, e.g., `wp-6.7` |
| `WP_DIST_TAG` | `'wp-6.7'` | The tag to update the dependencies to, e.g., `wp-6.7` |
| `PACKAGES` | `''` | Comma-separated list of additional `owner/repo`s to be updated |

#### Secrets

| Name | Description |
|----------------|-------------------------------------------------------------------------------------------------------------------------|
| `GH_API_TOKEN` | A personal access token (classic) with `repo` and `workflow` permissions, used to authenticate when calling GitHub APIs |
| `GH_TOKEN` | A personal access token (classic) with `repo` and `workflow` permissions, used to authenticate when calling GitHub APIs |

### Usage example

Expand All @@ -101,7 +101,7 @@ name: Update WordPress JS Dependencies Orchestrator
on:
workflow_dispatch:
inputs:
WP_VERSION:
WP_DIST_TAG:
description: 'The tag to update the dependencies to, e.g., `wp-6.7`'
required: true
PACKAGES:
Expand All @@ -113,8 +113,8 @@ jobs:
update-dependency-orchestrator:
uses: inpsyde/reusable-workflows/.github/workflows/update-wordpress-js-dependencies-orchestrator.yml@main
with:
WP_VERSION: ${{ inputs.WP_VERSION }}
WP_DIST_TAG: ${{ inputs.WP_DIST_TAG }}
PACKAGES: ${{ inputs.PACKAGES }}
secrets:
GH_API_TOKEN: ${{ secrets.DEPLOYBOT_REPO_READ_WRITE_TOKEN }}
GH_TOKEN: ${{ secrets.DEPLOYBOT_REPO_READ_WRITE_TOKEN }}
```

0 comments on commit 3a6d55d

Please sign in to comment.