diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..60b9b8cd --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,2 @@ +needs-changelog: + - base-branch: ['trunk'] diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..52534ece --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,36 @@ +name: "Pull Request Labeler" +on: + pull_request: + types: [closed] + +jobs: + labeler: + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk' + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + + comment_pr: + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk' + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + name: Comment about the change log label + steps: + - name: Comment PR + uses: thollander/actions-comment-pull-request@v3 + with: + message: | + Hey @${{ github.event.pull_request.assignee.login }}, good job getting this PR merged! :tada: + + Now, the `needs-changelog` label has been added to it. + + Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. + + If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. + + Thank you! :heart: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 064fef26..704e1550 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Label when approved - uses: pullreminders/label-when-approved-action@master + uses: abinoda/label-when-approved-action@master env: APPROVALS: '1' GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/includes/class-newspack-segments-model.php b/includes/class-newspack-segments-model.php index d29ba0c0..ab09758e 100644 --- a/includes/class-newspack-segments-model.php +++ b/includes/class-newspack-segments-model.php @@ -352,6 +352,11 @@ public static function get_segments( $include_inactive = true ) { ] ); + // if, for any reason, this was called too early and we don't have a registered taxonomy yet, let's not break the site. + if ( ! is_array( $terms ) ) { + return []; + } + $segments = array_map( function ( $segment ) { return self::get_segment_from_term( $segment ); diff --git a/package-lock.json b/package-lock.json index 5335b510..2bdaaca3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "classnames": "^2.5.1", "intersection-observer": "^0.12.2", "js-cookie": "^3.0.5", - "newspack-components": "^3.0.0", + "newspack-components": "^3.1.0", "qs": "^6.13.0" }, "devDependencies": { @@ -18704,9 +18704,9 @@ } }, "node_modules/newspack-components": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/newspack-components/-/newspack-components-3.0.0.tgz", - "integrity": "sha512-uYu0lJ3OenBERe35+TbbajX8gtMfqH3kCEYYgBSYyHBUcHm9cebxgGsJFyN8HMdpylaR0lySfQy3ix/VTwC9kg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/newspack-components/-/newspack-components-3.1.0.tgz", + "integrity": "sha512-jQjFWmO3Z52a57ZFwKPV/rMpoUKSeNHPGrCHDTziJpRclapidqJyk9pIp4FKbks8Xc8g0zP4hH397Bk/treTJQ==", "dependencies": { "@wordpress/base-styles": "^5.0.0", "@wordpress/components": "^28.0.0", diff --git a/package.json b/package.json index 552823aa..c824e13c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "classnames": "^2.5.1", "intersection-observer": "^0.12.2", "js-cookie": "^3.0.5", - "newspack-components": "^3.0.0", + "newspack-components": "^3.1.0", "qs": "^6.13.0" }, "devDependencies": {