Skip to content

Commit

Permalink
[CMSP-964] fix readme formatting (#264)
Browse files Browse the repository at this point in the history
* fix readme formatting

* make tag conditional on whether affected files were only assets

* add names for prettiness

* allow case insensitive matching

* add readme.md and .github to exclusions

* change run-plugin-update to is-asset-update for more clarity
  • Loading branch information
jazzsequence authored Mar 26, 2024
1 parent ce535d1 commit fa91256
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,42 @@ permissions:
contents: write

jobs:
check-status:
name: Check Status
runs-on: ubuntu-latest
outputs:
is-asset-update: ${{ steps.set-outputs.outputs.is-asset-update }}
steps:
- uses: actions/checkout@v4
- id: get-changed-files
uses: jitterbit/get-changed-files@v1
- id: set-outputs
run: |
echo "Changed files: ${{ steps.get-changed-files.outputs.all }}"
shopt -s nocasematch
run_plugin_update="true"
for file in ${{ steps.get-changed-files.outputs.all }}; do
if [[ ! "$file" =~ ^\.wordpress\.org/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]] && [[ $file =~ ^\.github/ ]]; then
run_plugin_update="false"
break
fi
done
echo "::set-output name=is-asset-update::$run_plugin_update"
asset-only:
name: WP.org Asset Only Update
needs: check-status
if: ${{ needs.check-status.outputs.is-asset-update == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: WP.org Asset Only Update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
tag:
needs: check-status
if: ${{ needs.check-status.outputs.is-asset-update == 'false' }}
name: Create Tag and Draft Release
runs-on: ubuntu-latest
steps:
Expand Down
26 changes: 12 additions & 14 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,18 @@ Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are

By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0 we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added:

```php
/**
* Add a custom post type to the ignored post types.
*
* @param array $ignored_post_types The array of ignored post types.
* @return array
*/
function filter_ignored_posts( $ignored_post_types ) {
$ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges.
return $ignored_post_types;
}

add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' );
```
/**
* Add a custom post type to the ignored post types.
*
* @param array $ignored_post_types The array of ignored post types.
* @return array
*/
function filter_ignored_posts( $ignored_post_types ) {
$ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges.
return $ignored_post_types;
}

add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' );

This will prevent the cache from being purged if the given post type is updated.

Expand Down

0 comments on commit fa91256

Please sign in to comment.