Further workflow tweaks #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: Test Plugins | |
on: | |
pull_request: | |
permissions: | |
pull-requests: write | |
jobs: | |
test: | |
name: ${{ matrix.plugin }} | |
if: github.event.pull_request.head.repo.full_name == 'johnbillion/plugin-infrastructure' | |
env: | |
BRANCH_REF: ${{ github.head_ref }} | |
SHA_REF: ${{ github.event.pull_request.head.sha }} | |
strategy: | |
matrix: | |
plugin: | |
- extended-cpts | |
- query-monitor | |
- user-switching | |
- wp-crontrol | |
fail-fast: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: johnbillion/${{ matrix.plugin }} | |
token: ${{ secrets.PLUGINS_PUSH_TOKEN }} | |
- name: Update tests references | |
run: | #shell | |
if [ -f .github/workflows/acceptance-tests.yml ]; then | |
sed -i 's/reusable-acceptance-tests.yml@trunk/reusable-acceptance-tests.yml@${{ env.SHA_REF }}/g' .github/workflows/acceptance-tests.yml | |
fi | |
if [ -f .github/workflows/coding-standards.yml ]; then | |
sed -i 's/reusable-coding-standards.yml@trunk/reusable-coding-standards.yml@${{ env.SHA_REF }}/g' .github/workflows/coding-standards.yml | |
fi | |
if [ -f .github/workflows/integration-tests.yml ]; then | |
sed -i 's/reusable-integration-tests.yml@trunk/reusable-integration-tests.yml@${{ env.SHA_REF }}/g' .github/workflows/integration-tests.yml | |
fi | |
- name: Check the changed files | |
run: | #shell | |
git diff | |
git status | |
- name: Open PR | |
uses: peter-evans/create-pull-request@v6 | |
id: cpr | |
with: | |
token: ${{ secrets.PLUGINS_PUSH_TOKEN }} | |
commit-message: Update Plugin Infrastructure to ${{ env.SHA_REF }} | |
title: Update Plugin Infrastructure to ${{ env.BRANCH_REF }} | |
body: | #markdown | |
This PR updates [Plugin Infrastructure](https://github.com/johnbillion/plugin-infrastructure) to `${{ env.BRANCH_REF }}`. | |
See ${{ github.event.pull_request._links.html.href }}. | |
This is an automated PR created by [the Test Plugins workflow](https://github.com/johnbillion/plugin-infrastructure/actions/workflows/test-plugins.yml). | |
branch: update-plugin-infrastructure | |
draft: true | |
- name: Set labels | |
run: | #shell | |
gh --repo johnbillion/plugin-infrastructure label create "pr:${{ matrix.plugin }}:${{ steps.cpr.outputs.pull-request-number }}" --force --color FEF2C0 | |
gh --repo johnbillion/plugin-infrastructure pr edit ${{ github.event.number }} --add-label "pr:${{ matrix.plugin }}:${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ github.token }} |