From ca74a884ca095b8264d7ad4ef02262ac92f41a67 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 1 Aug 2024 10:26:24 +1200 Subject: [PATCH] MNT Run module-standardiser --- .github/workflows/dispatch-ci.yml | 23 ++++--- .github/workflows/keepalive.yml | 8 ++- .github/workflows/merge-up.yml | 9 ++- .github/workflows/tag-patch-release.yml | 26 +++++++ CONTRIBUTING.md | 91 ------------------------- composer.json | 4 +- phpstan.neon.dist | 3 + 7 files changed, 59 insertions(+), 105 deletions(-) create mode 100644 .github/workflows/tag-patch-release.yml delete mode 100644 CONTRIBUTING.md create mode 100644 phpstan.neon.dist diff --git a/.github/workflows/dispatch-ci.yml b/.github/workflows/dispatch-ci.yml index fcb4f4b..26b7277 100644 --- a/.github/workflows/dispatch-ci.yml +++ b/.github/workflows/dispatch-ci.yml @@ -1,16 +1,21 @@ name: Dispatch CI on: - # At 5:25 AM UTC, only on Tuesday and Wednesday + # At 12:00 AM UTC, only on Monday and Tuesday schedule: - - cron: '25 5 * * 2,3' + - cron: '0 0 * * 1,2' + +permissions: {} jobs: dispatch-ci: - name: Dispatch CI - # Only run cron on the silverstripe account - if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule') - runs-on: ubuntu-latest - steps: - - name: Dispatch CI - uses: silverstripe/gha-dispatch-ci@v1 + name: Dispatch CI + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule') + runs-on: ubuntu-latest + permissions: + contents: read + actions: write + steps: + - name: Dispatch CI + uses: silverstripe/gha-dispatch-ci@v1 diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml index f604d79..822a64a 100644 --- a/.github/workflows/keepalive.yml +++ b/.github/workflows/keepalive.yml @@ -1,17 +1,21 @@ name: Keepalive on: - # At 5:25 AM UTC, on day 10 of the month + # At 9:45 PM UTC, on day 2 of the month schedule: - - cron: '25 5 10 * *' + - cron: '45 21 2 * *' workflow_dispatch: +permissions: {} + jobs: keepalive: name: Keepalive # Only run cron on the silverstripe account if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule') runs-on: ubuntu-latest + permissions: + actions: write steps: - name: Keepalive uses: silverstripe/gha-keepalive@v1 diff --git a/.github/workflows/merge-up.yml b/.github/workflows/merge-up.yml index 62dd390..f39981d 100644 --- a/.github/workflows/merge-up.yml +++ b/.github/workflows/merge-up.yml @@ -1,17 +1,22 @@ name: Merge-up on: - # At 5:25 AM UTC, only on Saturday + # At 12:00 AM UTC, only on Friday schedule: - - cron: '25 5 * * 6' + - cron: '0 0 * * 5' workflow_dispatch: +permissions: {} + jobs: merge-up: name: Merge-up # Only run cron on the silverstripe account if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule') runs-on: ubuntu-latest + permissions: + contents: write + actions: write steps: - name: Merge-up uses: silverstripe/gha-merge-up@v1 diff --git a/.github/workflows/tag-patch-release.yml b/.github/workflows/tag-patch-release.yml new file mode 100644 index 0000000..dc2db2b --- /dev/null +++ b/.github/workflows/tag-patch-release.yml @@ -0,0 +1,26 @@ +name: Tag patch release + +on: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + inputs: + latest_local_sha: + description: The latest local sha + required: true + type: string + +permissions: {} + +jobs: + tagpatchrelease: + name: Tag patch release + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Tag release + uses: silverstripe/gha-tag-release@v2 + with: + latest_local_sha: ${{ inputs.latest_local_sha }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 0c561d8..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,91 +0,0 @@ -# Contributing - -Contributions are welcome! You can help making this module better by explaining -a bug, suggest a change or a new feature. The correct way to do -that is to [create an issue](https://github.com/silverstripe/silverstripe-dynamodb/issues). - -We accept proposed code changes via [pull requests](https://github.com/silverstripe/silverstripe-dynamodb/pulls). - -## Tests - -Tests must pass and new functionality should be extended to cover any new lines -of code. See the [SilverStripe Unit and Integration Testing](https://docs.silverstripe.org/en/3.3/developer_guides/testing/) -documentation. - -## Code style - -The code to this module is following the [PSR-2 standard](http://www.php-fig.org/psr/psr-2/) -with the exception of SilverStripe spefic variable naming like `private static -$has_many` etc. We will not merge code that doesn't adhere to the standard. -Every push to a PR will run a code quality check via https://scrutinizer-ci.com/ and the results will -show in the Github PR. - -It's also possible to use the [PHP Coding Standards Fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer) -to check and fix the code style for you. - -## Commit messages - -Having good commit messages serves multiple purposes: - -- To speed up the reviewing process. -- To help us write a good release note. -- To help the future maintainers of this module finding out why a particular - change was made to the code or why a specific feature was added. - -Structure your commit message like this: - -> Short (50 chars or less) summary of changes -> -> More detailed explanatory text, if necessary. Wrap it to about 72 characters -> or so. In some contexts, the first line is treated as the subject of an email -> and the rest of the text as the body. The blank line separating the summary -> from the body is critical (unless you omit the body entirely); tools like -> rebase can get confused if you run the two together. -> -> Further paragraphs come after blank lines. -> -> * Bullet points are okay, too -> -> * An asterisk is used for the bullet, preceded by a single space, with blank -> lines in between, but conventions vary here -> -> Source [http://git-scm.com/book/ch5-2.html](http://git-scm.com/book/ch5-2.html) - -Write the summary line and description of what you have done in the imperative -mode, that is as if you were commanding someone. Start the line with "`Fix`", -"`Add`", "`Change`" instead of "Fixed", "Added", "Changed". - -Don't end the summary line with a period - it's a title and titles don't end -with a period. - -Always leave the second line blank. - -If you are having trouble expressing the change in a short subject line, you -probably need to make several commits, see below: - -## How to group changes together - -Group related commits into one commit. Try finding a set of changes that -describes a minmal working chnage and commit them as one change. This might be -better descibed with a good and bad example: - -*Bad* - - - change variable name to blah - - add check if user is logged in - - clean up whitespace - - reset users password and send email - -*Good* - - - add possibility for users to reset passwords - -*Bad* - - - fix bug on user password reset and remove old password resets - -*Good* - - - fix bug on user password reset - - remove old reset tokens from database - diff --git a/composer.json b/composer.json index 2946f5e..0441f9c 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,9 @@ }, "require-dev": { "phpunit/phpunit": "^9.6", - "squizlabs/php_codesniffer": "^3.7" + "squizlabs/php_codesniffer": "^3.7", + "silverstripe/standards": "^1", + "phpstan/extension-installer": "^1.3" }, "autoload": { "psr-4": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..d10aea0 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,3 @@ +parameters: + paths: + - code