diff --git a/.editorconfig b/.editorconfig index 7122a7a..2bf0901 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,11 +2,15 @@ root = true [*] charset = utf-8 +end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = true trim_trailing_whitespace = true +[*.md] +indent_size = 2 + [*.{yaml,yml}] indent_size = 2 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..21dd534 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + +* @ergebnis-bot @localheinz diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6a730e1..141a83a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # CONTRIBUTING -We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system. +We use [GitHub Actions](https://github.com/features/actions) as a continuous integration system. For details, take a look at the following workflow configuration files: @@ -10,12 +10,12 @@ For details, take a look at the following workflow configuration files: ## Coding Standards -We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files. +We use [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files. If you do not have `yamllint` installed yet, run ```sh -$ brew install yamllint +brew install yamllint ``` to install `yamllint`. @@ -23,7 +23,7 @@ to install `yamllint`. Run ```sh -$ make coding-standards +make coding-standards ``` to detect coding standard violations. @@ -33,7 +33,7 @@ to detect coding standard violations. Run ```sh -$ make +make ``` to detect coding standard violations! @@ -43,7 +43,7 @@ to detect coding standard violations! :bulb: Run ```sh -$ make help +make help ``` to display a list of available targets with corresponding descriptions. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cf38dba --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +The following versions of `ergebnis/.github` have active support: + +- `^1.10.0` + +## Unsupported Versions + +The following versions of `ergebnis/.github` have reached their end of life: + +- `<1.10.0` + +## Reporting a Vulnerability + +If you believe that you have found a security vulnerability, please send an email to `am@localheinz.com`. Ensure to include all details required to understand the severity of the issue. diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..6b0897f --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,125 @@ +# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 + +updates: + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/pull-request/add-assignee" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/pull-request/add-label-based-on-branch-name" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/pull-request/approve" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/pull-request/merge" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/pull-request/request-review" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/github/release/create" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/oh-dear/check/request-run" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/oh-dear/maintenance-period/start" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/oh-dear/maintenance-period/stop" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/actions/phive/install" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index f7872ee..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates - -version: 2 - -updates: - - commit-message: - include: "scope" - prefix: "github-actions" - directory: "/" - labels: - - "dependency" - open-pull-requests-limit: 10 - package-ecosystem: "github-actions" - schedule: - interval: "daily" diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000..5226faf --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,6 @@ +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes + +changelog: + exclude: + authors: + - "dependabot" diff --git a/.github/settings.yml b/.github/settings.yml index fee26bd..5d40ff0 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,4 +1,4 @@ -# https://github.com/probot/settings +# https://github.com/repository-settings/app branches: - name: "main" @@ -13,8 +13,8 @@ branches: require_code_owner_reviews: true required_approving_review_count: 1 required_status_checks: - contexts: - - "Coding Standards" + checks: + - context: "Coding Standards" strict: false restrictions: @@ -52,10 +52,6 @@ labels: color: "ee0701" description: "" - - name: "stale" - color: "eeeeee" - description: "" - # https://docs.github.com/en/rest/reference/repos#update-a-repository repository: @@ -65,15 +61,19 @@ repository: archived: false default_branch: "main" delete_branch_on_merge: true - description: ":heart: Provides default community health files for the @ergebnis organization." + description: ":heart: Provides default community health files and composite actions for the @ergebnis organization." + enable_automated_security_fixes: true + enable_vulnerability_alerts: true + has_discussions: false has_downloads: false - has_issues: false + has_issues: true has_pages: false has_projects: false has_wiki: false + is_template: false name: ".github" private: false # https://docs.github.com/en/rest/reference/repos#replace-all-repository-topics - topics: "default, community, health, files" + topics: "default, community, health, files, composite, actions" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 7beb556..ded9d74 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -14,12 +14,14 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + steps: - name: "Checkout" - uses: "actions/checkout@v3.0.0" + uses: "actions/checkout@v5.0.0" - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v3.1.0" + uses: "ibiqlik/action-yamllint@v3.1.1" with: config_file: ".yamllint.yaml" file_or_dir: "." diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 4cc5444..61d417f 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -15,6 +15,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + if: > github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' && @@ -24,23 +26,23 @@ jobs: steps: - name: "Request review from @ergebnis-bot" - uses: "ergebnis/.github/actions/github/pull-request/request-review@1.3.2" + uses: "ergebnis/.github/actions/github/pull-request/request-review@1.10.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" reviewer: "ergebnis-bot" - name: "Assign @ergebnis-bot" - uses: "ergebnis/.github/actions/github/pull-request/add-assignee@1.3.2" + uses: "ergebnis/.github/actions/github/pull-request/add-assignee@1.10.0" with: - github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" assignee: "ergebnis-bot" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - name: "Approve pull request" - uses: "ergebnis/.github/actions/github/pull-request/approve@1.3.2" + uses: "ergebnis/.github/actions/github/pull-request/approve@1.10.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - name: "Merge pull request" - uses: "ergebnis/.github/actions/github/pull-request/merge@1.3.2" + uses: "ergebnis/.github/actions/github/pull-request/merge@1.10.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5a18b72..9b17703 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,8 +13,23 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + steps: - name: "Create release" - uses: "ergebnis/.github/actions/github/release/create@1.3.2" + uses: "ergebnis/.github/actions/github/release/create@1.10.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + + - name: "Post to twitter.com about release" + uses: "Eomm/why-don-t-you-tweet@v2.0.0" + env: + TWITTER_ACCESS_TOKEN: "${{ secrets.ERGEBNIS_TWITTER_ACCESS_TOKEN }}" + TWITTER_ACCESS_TOKEN_SECRET: "${{ secrets.ERGEBNIS_TWITTER_ACCESS_TOKEN_SECRET }}" + TWITTER_CONSUMER_API_KEY: "${{ secrets.ERGEBNIS_TWITTER_CONSUMER_API_KEY }}" + TWITTER_CONSUMER_API_SECRET: "${{ secrets.ERGEBNIS_TWITTER_CONSUMER_API_KEY_SECRET }}" + with: + tweet-message: | + ❤️ Just released: ${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:${{ env.RELEASE_TAG }}. + + ${{ env.RELEASE_HTML_URL }} diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml index 39be0e6..1218ec2 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -13,8 +13,10 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + steps: - name: "Add labels based on branch name" - uses: "ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name@1.3.2" + uses: "ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name@1.10.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" diff --git a/.yamllint.yaml b/.yamllint.yaml index 2c9e3b6..0f43625 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -1,7 +1,7 @@ extends: "default" ignore: | - .notes/ + .note/ rules: braces: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3283296..d619782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,99 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased -For a full diff see [`1.4.0...main`][1.4.0...main]. +For a full diff see [`1.9.3...main`][1.9.3...main]. + +### Added + +- Added `github/release/publish` to allow publishing a release ([#215]), by [@localheinz] + +### Changed + +- Added a `draft` input to `github/release/create` to allow creating releases in draft mode ([#214]), by [@localheinz] + +## [`1.9.3`][1.9.3] + +For a full diff see [`1.9.2...1.9.3`][1.9.2...1.9.3]. + +### Fixed + +- Updated `actions/cache` ([#207], [#208], [#209]), by [@dependabot] + +## [`1.9.2`][1.9.2] + +For a full diff see [`1.9.1...1.9.2`][1.9.1...1.9.2]. + +### Fixed + +- Expose `PULL_REQUEST_BRANCH_NAME` instead of overwriting `PULL_REQUEST_NUMBER` environment variable when adding label based on branch name ([#194]), by [@jaymecd] + +## [`1.9.1`][1.9.1] + +For a full diff see [`1.9.0...1.9.1`][1.9.0...1.9.1]. + +### Fixed + +- Fixed invalid attempt to calculate cache key for `phars.xml` with `hashfiles()` function ([#197]), by [@lotyp] + +## [`1.9.0`][1.9.0] + +For a full diff see [`1.8.0...1.9.0`][1.8.0...1.9.0]. + +### Changed + +- Started exposing a `RELEASE_HTML_URL` environment variable after creating a release with `actions/github/release/create` ([#183]), by [@localheinz] + +## [`1.8.0`][1.8.0] + +For a full diff see [`1.7.0...1.8.0`][1.7.0...1.8.0]. + +### Added + +- Added composite action `phive/install` for installing dependencies with [`phive`](https://phar.io) ([#142]), by [@localheinz] + +## [`1.7.0`][1.7.0] + +For a full diff see [`1.6.0...1.7.0`][1.6.0...1.7.0]. + +### Added + +- Added composite actions `oh-dear/check/request-run` for requesting a check run on [ohdear.app](https://ohdear.app) ([#124]), by [@localheinz] + +## [`1.6.0`][1.6.0] + +For a full diff see [`1.5.1...1.6.0`][1.5.1...1.6.0]. + +### Added + +- Added composite actions `oh-dear/maintenance-period/start` and `oh-dear/maintenance-period/stop` for starting and stopping maintenance periods on [ohdear.app](https://ohdear.app) ([#123]), by [@localheinz] + +## [`1.5.1`][1.5.1] + +For a full diff see [`1.5.0...1.5.1`][1.5.0...1.5.1]. + +### Fixed + +- Fixed a condition in `github/pull-request/add-label-based-on-branch-name` ([#96]), by [@localheinz] + +## [`1.5.0`][1.5.0] + +For a full diff see [`1.4.1...1.5.0`][1.4.1...1.5.0]. + +### Added + +- Added composite action `composer/determine-root-version` ([#87]), by [@localheinz] + +### Fixed + +- Required a value for the `working-directory` input of the composite action `composer/determine-cache-directory` ([#82]), by [@localheinz] + +## [`1.4.1`][1.4.1] + +For a full diff see [`1.4.0...1.4.1`][1.4.0...1.4.1]. + +### Fixed + +- Captured response in the composite action `github/release/create` ([#82]), by [@localheinz] ## [`1.4.0`][1.4.0] @@ -82,6 +174,16 @@ For a full diff see [`1.0.0...main`][1.0.0...main]. [1.3.1]: https://github.com/ergebnis/.github/releases/tag/1.3.1 [1.3.2]: https://github.com/ergebnis/.github/releases/tag/1.3.2 [1.4.0]: https://github.com/ergebnis/.github/releases/tag/1.4.0 +[1.4.1]: https://github.com/ergebnis/.github/releases/tag/1.4.1 +[1.5.0]: https://github.com/ergebnis/.github/releases/tag/1.5.0 +[1.5.1]: https://github.com/ergebnis/.github/releases/tag/1.5.1 +[1.6.0]: https://github.com/ergebnis/.github/releases/tag/1.6.0 +[1.7.0]: https://github.com/ergebnis/.github/releases/tag/1.7.0 +[1.8.0]: https://github.com/ergebnis/.github/releases/tag/1.8.0 +[1.9.0]: https://github.com/ergebnis/.github/releases/tag/1.9.0 +[1.9.1]: https://github.com/ergebnis/.github/releases/tag/1.9.1 +[1.9.2]: https://github.com/ergebnis/.github/releases/tag/1.9.2 +[1.9.3]: https://github.com/ergebnis/.github/releases/tag/1.9.3 [ca7f15d...1.0.0]: https://github.com/ergebnis/.github/compare/ca7f15d...1.0.0 [1.0.0...1.1.0]: https://github.com/ergebnis/.github/compare/1.0.0...1.1.0 @@ -91,7 +193,17 @@ For a full diff see [`1.0.0...main`][1.0.0...main]. [1.3.0...1.3.1]: https://github.com/ergebnis/.github/compare/1.3.0...1.3.1 [1.3.1...1.3.2]: https://github.com/ergebnis/.github/compare/1.3.1...1.3.2 [1.3.2...1.4.0]: https://github.com/ergebnis/.github/compare/1.3.2...1.4.0 -[1.4.0...main]: https://github.com/ergebnis/.github/compare/1.4.0...main +[1.4.0...1.4.1]: https://github.com/ergebnis/.github/compare/1.4.0...1.4.1 +[1.4.1...1.5.0]: https://github.com/ergebnis/.github/compare/1.4.1...1.5.0 +[1.5.0...1.5.1]: https://github.com/ergebnis/.github/compare/1.5.0...1.5.1 +[1.5.1...1.6.0]: https://github.com/ergebnis/.github/compare/1.5.1...1.6.0 +[1.6.0...1.7.0]: https://github.com/ergebnis/.github/compare/1.6.0...1.7.0 +[1.7.0...1.8.0]: https://github.com/ergebnis/.github/compare/1.7.0...1.8.0 +[1.8.0...1.9.0]: https://github.com/ergebnis/.github/compare/1.8.0...1.9.0 +[1.9.0...1.9.1]: https://github.com/ergebnis/.github/compare/1.9.0...1.9.1 +[1.9.1...1.9.2]: https://github.com/ergebnis/.github/compare/1.9.1...1.9.2 +[1.9.2...1.9.3]: https://github.com/ergebnis/.github/compare/1.9.2...1.9.3 +[1.9.3...main]: https://github.com/ergebnis/.github/compare/1.9.3...main [#47]: https://github.com/ergebnis/.github/pull/47 [#48]: https://github.com/ergebnis/.github/pull/48 @@ -106,5 +218,22 @@ For a full diff see [`1.0.0...main`][1.0.0...main]. [#76]: https://github.com/ergebnis/.github/pull/76 [#79]: https://github.com/ergebnis/.github/pull/79 [#80]: https://github.com/ergebnis/.github/pull/80 - +[#82]: https://github.com/ergebnis/.github/pull/82 +[#87]: https://github.com/ergebnis/.github/pull/87 +[#96]: https://github.com/ergebnis/.github/pull/96 +[#123]: https://github.com/ergebnis/.github/pull/123 +[#124]: https://github.com/ergebnis/.github/pull/124 +[#142]: https://github.com/ergebnis/.github/pull/142 +[#183]: https://github.com/ergebnis/.github/pull/183 +[#194]: https://github.com/ergebnis/.github/pull/194 +[#197]: https://github.com/ergebnis/.github/pull/197 +[#207]: https://github.com/ergebnis/.github/pull/207 +[#208]: https://github.com/ergebnis/.github/pull/208 +[#209]: https://github.com/ergebnis/.github/pull/209 +[#214]: https://github.com/ergebnis/.github/pull/214 +[#215]: https://github.com/ergebnis/.github/pull/215 + +[@dependabot]: https://github.com/dependabot +[@jaymecd]: https://github.com/jaymecd [@localheinz]: https://github.com/localheinz +[@lotyp]: https://github.com/lotyp diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index 64bf50c..0000000 --- a/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @localheinz diff --git a/FUNDING.yml b/FUNDING.yml deleted file mode 100644 index 66085dc..0000000 --- a/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: "localheinz" diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..cabb837 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,16 @@ +# The MIT License (MIT) + +Copyright (c) 2019-2023 Andreas Möller + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the _Software_), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED **AS IS**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 2077d49..ad20f03 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,793 @@ # .github -[![Integrate](https://github.com/ergebnis/.github/workflows/Integrate/badge.svg?branch=main)](https://github.com/ergebnis/.github/actions) -[![Merge](https://github.com/ergebnis/.github/workflows/Merge/badge.svg?branch=main)](https://github.com/ergebnis/.github/actions) -[![Release](https://github.com/ergebnis/.github/workflows/Release/badge.svg?branch=main)](https://github.com/ergebnis/.github/actions) -[![Triage](https://github.com/ergebnis/.github/workflows/Triage/badge.svg?branch=main)](https://github.com/ergebnis/.github/actions) +[![Integrate](https://github.com/ergebnis/.github/workflows/Integrate/badge.svg)](https://github.com/ergebnis/.github/actions) +[![Merge](https://github.com/ergebnis/.github/workflows/Merge/badge.svg)](https://github.com/ergebnis/.github/actions) +[![Release](https://github.com/ergebnis/.github/workflows/Release/badge.svg)](https://github.com/ergebnis/.github/actions) -Provides community health files for the [@ergebnis](https://github.com/ergebnis) organization. +This project provides [community health files](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file) and [composite actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action) for the [@ergebnis](https://github.com/ergebnis) organization. -:bulb: Also see [GitHub Docs: Creating a default community health file](https://docs.github.com/en/github/building-a-strong-community/creating-a-default-community-health-file). +## Composite Actions + +This project provides the following composite actions: + +- [`ergebnis/.github/actions/composer/determine-cache-directory`](#composer-determine-cache-directory) +- [`ergebnis/.github/actions/composer/determine-root-version`](#composer-determine-root-version) +- [`ergebnis/.github/actions/composer/install`](#composer-install) +- [`ergebnis/.github/actions/github/pull-request/add-assignee`](#github-pull-request-add-assignee) +- [`ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name`](#github-pull-request-add-label-based-on-branch-name) +- [`ergebnis/.github/actions/github/pull-request/approve`](#github-pull-request-approve) +- [`ergebnis/.github/actions/github/pull-request/merge`](#github-pull-request-merge) +- [`ergebnis/.github/actions/github/pull-request/request-review`](#github-pull-request-review) +- [`ergebnis/.github/actions/github/release/create`](#github-release-create) +- [`ergebnis/.github/actions/github/release/publish`](#github-release-publish) +- [`ergebnis/.github/actions/oh-dear/check/request-run`](#oh-dear-check-request-run) +- [`ergebnis/.github/actions/oh-dear/maintenance-period/start`](#oh-dear-maintenance-period-start) +- [`ergebnis/.github/actions/oh-dear/maintenance-period/stop`](#oh-dear-maintenance-period-stop) +- [`ergebnis/.github/actions/phive/install`](#phive-install) + +### `ergebnis/.github/actions/composer/determine-cache-directory` + +This action determines the cache directory for [`composer`](https://github.com/composer/composer) and exports it as [`COMPOSER_CACHE_DIR`](https://getcomposer.org/doc/03-cli.md#composer-cache-dir) environment variable. + +This is useful for caching dependencies installed with `composer` using [`actions/cache`](https://github.com/actions/cache). + +```yaml +name: "Integrate" + +on: + pull_request: null + push: + branches: + - "main" + +jobs: + tests: + name: "Tests" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.35.4" + with: + coverage: "none" + php-version: "8.1" + + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.3" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v4.2.4" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "composer-${{ hashFiles('composer.lock') }}" + restore-keys: "composer-" +``` + +For details, see [`actions/composer/determine-cache-directory/action.yaml`](actions/composer/determine-cache-directory/action.yaml). + +#### Inputs + +- `working-directory`, optional: The working directory to use. Defaults to `"."`. + +#### Outputs + +none + +#### Side Effects + +- The `COMPOSER_CACHE_DIR` environment variable contains the path to the composer cache directory. + +### `ergebnis/.github/actions/composer/determine-root-version` + +This action determines the composer root version and exports it as [`COMPOSER_ROOT_VERSION`](https://getcomposer.org/doc/03-cli.md#composer-root-version) environment variable. + +This is useful for a package that depends on itself, for example, [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit/blob/802b91a979fb79f39ac8f87def3996913a7fef11/.github/workflows/ci.yml#L9-L10) + +```yaml +name: "Integrate" + +on: + pull_request: null + push: + branches: + - "main" + +jobs: + tests: + name: "Tests" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.35.4" + with: + coverage: "none" + php-version: "8.1" + + - name: "Determine composer root version" + uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.3" +``` + +For details, see [`actions/composer/determine-root-version/action.yaml`](actions/composer/determine-root-version/action.yaml). + +#### Inputs + +- `branch`, optional: The name of the branch, defaults to `"main"`. +- `working-directory`, optional: The working directory to use, defaults to `"."`. + +#### Outputs + +none + +#### Side Effects + +- The `COMPOSER_ROOT_VERSION` environment variable contains the root version if it has been defined as `branch-alias` in `composer.json`. + + ```json + { + "extra": { + "branch-alias": { + "dev-main": "10.0-dev" + } + } + } + ``` + +### `ergebnis/.github/actions/composer/install` + +This action installs or updates dependencies with [`composer`](https://getcomposer.org/doc/03-cli.md#install-i). + +```yaml +name: "Integrate" + +on: + pull_request: null + push: + branches: + - "main" + +jobs: + tests: + name: "Tests" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + dependencies: + - "lowest" + - "locked" + - "highest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.35.4" + with: + coverage: "none" + php-version: "8.1" + + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.3" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v4.2.4" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "composer-${{ matrix.dependencies }}-" + + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.9.3" + with: + dependencies: "${{ matrix.dependencies }}" +``` + +For details, see [`actions/composer/install/action.yaml`](actions/composer/install/action.yaml). + +#### Inputs + +- `dependencies`, optional: Which dependencies to install, one of `"lowest"`, `"locked"`, `"highest"` +- `working-directory`, optional: The working directory to use, defaults to `"."`. + +#### Outputs + +none + +#### Side Effects + +- When `dependencies` is set to `"lowest"`, dependencies are installed in the directory specified by `working-directory` with + + ```shell + composer update --ansi --no-interaction --no-progress --prefer-lowest + ```` +- When `dependencies` is set to `"locked"`, dependencies are installed in the directory specified by `working-directory` with + + ```shell + composer install --ansi --no-interaction --no-progress + ``` + +- When `dependencies` is set to `"highest"`, dependencies are installed in the directory specified by `working-directory` with + + ```shell + composer update --ansi --no-interaction --no-progress + ```` + +### `ergebnis/.github/actions/github/pull-request/add-assignee` + +This action adds an assignee to a pull request. + +This is useful when you want to automatically merge a pull request, but prefer to assign a bot user beforehand. + +```yaml +name: "Merge" + +on: + workflow_run: + types: + - "completed" + workflows: + - "Integrate" + +jobs: + merge: + name: "Merge" + + runs-on: "ubuntu-latest" + + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + github.actor == 'dependabot[bot]' && ( + startsWith(github.event.workflow_run.head_commit.message, 'composer(deps-dev)') || + startsWith(github.event.workflow_run.head_commit.message, 'github-actions(deps)') + ) + + steps: + - name: "Assign @ergebnis-bot" + uses: "ergebnis/.github/actions/github/pull-request/add-assignee@1.9.3" + with: + assignee: "ergebnis-bot" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/pull-request/add-assignee/action.yaml`](actions/github/pull-request/add-assignee/action.yaml). + +#### Inputs + +- `assignee`, required: The username of a user to add as an assignee to a pull request. +- `github-token`, required: The GitHub token of a user with permission to add assignees to a pull request + +#### Outputs + +none + +#### Side Effects + +- The GitHub user with the username specified in the `assignee` input is assigned to the pull request. +- The `PULL_REQUEST_NUMBER` environment variable contains the number of the pull request. + +### `ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name` + +This action adds a label to a pull request based on the name of the branch. + +```yaml +# https://docs.github.com/en/actions + +name: "Triage" + +on: # yamllint disable-line rule:truthy + pull_request_target: + types: + - "opened" + +jobs: + label: + name: "Label" + + runs-on: "ubuntu-latest" + + steps: + - name: "Add labels based on branch name" + uses: "ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name@1.9.3" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/pull-request/add-label-based-on-branch-name/action.yaml`](actions/github/pull-request/add-label-based-on-branch-name/action.yaml). + +#### Inputs + +- `github-token`, required: The GitHub token of a user with permission to add labels to to a pull request. + +#### Outputs + +none + +#### Side Effects + +- When the branch name starts with `feature/`, the label `enhancement` is added to the pull request by the user who owns the GitHub token specified with the `github-token` input. +- When the branch name starts with `fix/`, the label `bug` is added to the pull request by the user who owns the GitHub token specified with the `github-token` input. +- The `PULL_REQUEST_BRANCH_NAME` environment variable contains the name of the head branch of the pull request. +- The `PULL_REQUEST_NUMBER` environment variable contains the number of the pull request. + +### `ergebnis/.github/actions/github/pull-request/approve` + +This action approves a pull request. + +This is useful when you want to automatically merge a pull request, but prefer to let a bot user approve the pull request beforehand. + +```yaml +name: "Merge" + +on: + workflow_run: + types: + - "completed" + workflows: + - "Integrate" + +jobs: + merge: + name: "Merge" + + runs-on: "ubuntu-latest" + + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + github.actor == 'dependabot[bot]' && ( + startsWith(github.event.workflow_run.head_commit.message, 'composer(deps-dev)') || + startsWith(github.event.workflow_run.head_commit.message, 'github-actions(deps)') + ) + + steps: + - name: "Approve pull request" + uses: "ergebnis/.github/actions/github/pull-request/approve@1.9.3" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/pull-request/merge/action.yaml`](actions/github/pull-request/merge/action.yaml). + +#### Inputs + +- `github-token`, required: The GitHub token of a user with permission to approve a pull request + +#### Outputs + +none + +#### Side Effects + +- The pull request is approved by the user who owns the GitHub token specified with the `github-token` input. +- The `PULL_REQUEST_NUMBER` environment variable contains the number of the pull request. + +### `ergebnis/.github/actions/github/pull-request/merge` + +This action merges a pull request. + +This is useful when you want to automatically merge a pull request, for example, opened by [`dependabot`](https://github.com/dependabot). + +```yaml +name: "Merge" + +on: + workflow_run: + types: + - "completed" + workflows: + - "Integrate" + +jobs: + merge: + name: "Merge" + + runs-on: "ubuntu-latest" + + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + github.actor == 'dependabot[bot]' && ( + startsWith(github.event.workflow_run.head_commit.message, 'composer(deps-dev)') || + startsWith(github.event.workflow_run.head_commit.message, 'github-actions(deps)') + ) + + steps: + - name: "Merge pull request" + uses: "ergebnis/.github/actions/github/pull-request/merge@1.9.3" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/pull-request/merge/action.yaml`](actions/github/pull-request/merge/action.yaml). + +#### Inputs + +- `github-token`, required: The GitHub token of a user with permission to merge a pull request +- `merge-method`, option: The merge method to use, one `"merge"`, `"rebase"`, `"squash"`, defaults to `"merge"` + +#### Outputs + +none + +#### Side Effects + +- The pull request is merged by the user who owns the GitHub token specified with the `github-token` input. +- The `PULL_REQUEST_NUMBER` environment variable contains the number of the pull request. + +### `ergebnis/.github/actions/github/pull-request/request-review` + +This action requests a review for a pull request. + +This is useful when you want to automatically merge a pull request, but prefer to let a bot user self-request a review for the pull request beforehand. + +```yaml +name: "Merge" + +on: + workflow_run: + types: + - "completed" + workflows: + - "Integrate" + +jobs: + merge: + name: "Merge" + + runs-on: "ubuntu-latest" + + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + github.actor == 'dependabot[bot]' && ( + startsWith(github.event.workflow_run.head_commit.message, 'composer(deps-dev)') || + startsWith(github.event.workflow_run.head_commit.message, 'github-actions(deps)') + ) + + steps: + - name: "Request review from @ergebnis-bot" + uses: "ergebnis/.github/actions/github/pull-request/request-review@1.9.3" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + reviewer: "ergebnis-bot" +``` + +For details, see [`actions/github/pull-request/request-review/action.yaml`](actions/github/pull-request/request-review/action.yaml). + +#### Inputs + +- `github-token`, required: The GitHub token of a user with permission to request reviewers for a pull request. +- `reviewer`, required: The username of user to request review from for a pull request. + +#### Outputs + +none + +#### Side Effects + +- A pull request review is requested for the user identified by the value of the `reviewer` input by the user who owns the GitHub token specified with the `github-token` input. +- The `PULL_REQUEST_NUMBER` environment variable contains the number of the pull request. + +### `ergebnis/.github/actions/github/release/create` + +This action creates a release. + +This is useful when you automatically want to create releases with [automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes). + +```yaml + +name: "Release" + +on: + push: + tags: + - "**" + +jobs: + release: + name: "Release" + + runs-on: "ubuntu-latest" + + steps: + - name: "Create release" + uses: "ergebnis/.github/actions/github/release/create@1.9.3" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/release/create/action.yaml`](actions/github/release/create/action.yaml). + +#### Inputs + +- `draft`, optional: Whether to create a draft or a published release. +- `github-token`, required: The GitHub token of a user with permission to create a release. + +#### Outputs + +none + +#### Side Effects + +- A release is created by the user who owns the GitHub token specified with the `github-token` input. +- The `RELEASE_HTML_URL` environment variable contains the HTML URL to the release. +- The `RELEASE_ID` environment variable contains the release identifier. +- The `RELEASE_TAG` environment variable contains the release tag. +- The `RELEASE_UPLOAD_URL` environment variable contains the URL for uploading release assets. +- +### `ergebnis/.github/actions/github/release/publish` + +This action publishes a release. + +This is useful when you want to publish a release created in draft mode. + +```yaml + +name: "Release" + +on: + push: + tags: + - "**" + +jobs: + release: + name: "Release" + + runs-on: "ubuntu-latest" + + steps: + - name: "Publish release" + uses: "ergebnis/.github/actions/github/release/publish@1.10.0" + with: + release-id: "9001" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" +``` + +For details, see [`actions/github/release/publish/action.yaml`](actions/github/release/publish/action.yaml). + +#### Inputs + +- `github-token`, required: The GitHub token of a user with permission to create a release. +- `release-id`, required: The release identifier. + +#### Outputs + +none + +#### Side Effects + +- The release identified by the release identifier is published by the user who owns the GitHub token specified with the `github-token` input. + +### `ergebnis/.github/actions/oh-dear/check/request-run` + +This action requests a [check](https://ohdear.app/docs/general/checks) run on [Oh Dear!](https://ohdear.app). + +```yaml +name: "Deploy" + +on: + push: + branches: + - "main" + +jobs: + deploy: + name: "Deploy" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + with: + fetch-depth: 50 + + - name: "Request broken links check on ohdear.app" + uses: "ergebnis/.github/actions/oh-dear/maintenance-period/start@1.9.3" + with: + oh-dear-api-token: "${{ secrets.OH_DEAR_API_TOKEN }}" + oh-dear-check-id: "${{ secrets.OH_DEAR_BROKEN_LINKS_CHECK_ID }}" +``` + +For details, see [`actions/oh-dear/check/request-run/action.yaml`](actions/oh-dear/check/request-run/action.yaml). + +#### Inputs + +- `oh-dear-api-token`, required: The Oh Dear API token of a user with permission to request a check run +- `oh-dear-check-id`, required: Check identifer of an Oh Dear check for which to request a run + +#### Outputs + +none + +#### Side Effects + +- A check run is requested by the user who owns the Oh Dear API token specified with the `oh-dear-api-token` input for the check identified by the `oh-dear-check-id` input. + +### `ergebnis/.github/actions/oh-dear/maintenance-period/start` + +This action starts a [maintenance period](https://ohdear.app/docs/general/maintenance-windows) on [Oh Dear!](https://ohdear.app). + +```yaml +name: "Deploy" + +on: + push: + branches: + - "main" + +jobs: + deploy: + name: "Deploy" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + with: + fetch-depth: 50 + + - name: "Start maintenance period on ohdear.app" + uses: "ergebnis/.github/actions/oh-dear/maintenance-period/start@1.9.3" + with: + oh-dear-api-token: "${{ secrets.OH_DEAR_API_TOKEN }}" + oh-dear-site-id: "${{ secrets.OH_DEAR_SITE_ID }}" +``` + +For details, see [`actions/oh-dear/maintenance-period/start/action.yaml`](actions/oh-dear/maintenance-period/start/action.yaml). + +#### Inputs + +- `oh-dear-api-token`, required: The Oh Dear API token of a user with permission to start a maintenance period +- `oh-dear-site-id`, required: Site identifer of an Oh Dear site for which to start a maintenance period + +#### Outputs + +none + +#### Side Effects + +- A maintenance period is started by the user who owns the Oh Dear API token specified with the `oh-dear-api-token` input for the site identified by the `oh-dear-site-id` input. + +### `ergebnis/.github/actions/oh-dear/maintenance-period/stop` + +This action stops a [maintenance period](https://ohdear.app/docs/general/maintenance-windows) on [Oh Dear!](https://ohdear.app). + +```yaml +name: "Deploy" + +on: + push: + branches: + - "main" + +jobs: + deploy: + name: "Deploy" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + with: + fetch-depth: 50 + + - name: "Stop maintenance period on ohdear.app" + uses: "ergebnis/.github/actions/oh-dear/maintenance-period/stop@1.9.3" + with: + oh-dear-api-token: "${{ secrets.OH_DEAR_API_TOKEN }}" + oh-dear-site-id: "${{ secrets.OH_DEAR_SITE_ID }}" +``` + +For details, see [`actions/oh-dear/maintenance-period/stop/action.yaml`](actions/oh-dear/maintenance-period/stop/action.yaml). + +#### Inputs + +- `oh-dear-api-token`, required: The Oh Dear API token of a user with permission to stop a maintenance period +- `oh-dear-site-id`, required: Site identifer of an Oh Dear site for which to stop a maintenance period + +#### Outputs + +none + +#### Side Effects + +- A maintenance period is stopped by the user who owns the Oh Dear API token specified with the `oh-dear-api-token` input for the site identified by the `oh-dear-site-id` input. + +### `ergebnis/.github/actions/phive/install` + +This action installs dependencies with [`phive`](https://phar.io). + +```yaml +name: "Integrate" + +on: + pull_request: null + push: + branches: + - "main" + +jobs: + tests: + name: "Tests" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5.0.0" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.35.4" + with: + coverage: "none" + php-version: "8.1" + tools: "phive" + + - name: "Install dependencies with phive" + uses: "ergebnis/.github/actions/phive/install@1.9.3" + with: + trust-gpg-keys: "0x033E5F8D801A2F8D,0x2A8299CE842DD38C" +``` + +For details, see [`actions/phive/install/action.yaml`](actions/phive/install/action.yaml). + +#### Inputs + +- `phive-home`, optional: Which directory to use as `PHIVE_HOME` directory, defaults to `".build/phive"`. +- `trust-gpg-keys`, required: Which GPG keys to trust, a comma-separated list of trusted GPG keys + +#### Outputs + +none + +#### Side Effects + +- Given that `phive` is available, `phive` could find a `phars.xml`, and keys presented by packages are listed using the `trust-gpg-keys` option, dependencies are installed with `phive`. + +The directory configured by the `phive-home` directory is cached using [`actions/cache`](https://github.com/actions/cache). ## Changelog -Please have a look at [`CHANGELOG.md`](CHANGELOG.md). +The maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md). ## Contributing -Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md). +The maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md). ## Code of Conduct -Please have a look at [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md). +The maintainers of this project ask contributors to follow the [code of conduct](CODE_OF_CONDUCT.md). + +## General Support Policy + +The maintainers of this project provide limited support. + +You can support the maintenance of this project by [sponsoring @ergebnis](https://github.com/sponsors/ergebnis). + +## Security Policy + +This project has a [security policy](.github/SECURITY.md). + +## License + +This project uses the [MIT license](LICENSE.md). -## Curious what I am building? +## Social -:mailbox_with_mail: [Subscribe to my list](https://localheinz.com/projects/), and I will occasionally send you an email to let you know what I am working on. +Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter. diff --git a/actions/composer/determine-cache-directory/action.yaml b/actions/composer/determine-cache-directory/action.yaml index d563d86..908af41 100644 --- a/actions/composer/determine-cache-directory/action.yaml +++ b/actions/composer/determine-cache-directory/action.yaml @@ -11,7 +11,7 @@ inputs: working-directory: default: "." description: "Which directory to use as working directory" - required: false + required: true runs: using: "composite" diff --git a/actions/composer/determine-root-version/action.yaml b/actions/composer/determine-root-version/action.yaml new file mode 100644 index 0000000..016d19f --- /dev/null +++ b/actions/composer/determine-root-version/action.yaml @@ -0,0 +1,29 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://getcomposer.org/doc/03-cli.md#composer-root-version + +name: "Determine composer root version" + +description: "Determines the composer root version and exports it as COMPOSER_ROOT_VERSION environment variable" + +inputs: + branch: + default: "main" + description: "Name of the branch, e.g. \"main\"" + required: true + working-directory: + default: "." + description: "Which directory to use as working directory" + required: true + +runs: + using: "composite" + + steps: + - name: "Determine composer root version" + env: + COMPOSER_DETERMINE_ROOT_VERSION_BRANCH: "${{ inputs.branch }}" + COMPOSER_DETERMINE_ROOT_VERSION_WORKING_DIRECTORY: "${{ inputs.working-directory }}" + run: "${{ github.action_path }}/run.sh" + shell: "bash" diff --git a/actions/composer/determine-root-version/run.sh b/actions/composer/determine-root-version/run.sh new file mode 100755 index 0000000..0eb7444 --- /dev/null +++ b/actions/composer/determine-root-version/run.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +branch="${COMPOSER_DETERMINE_ROOT_VERSION_BRANCH}" +workingDirectory="${COMPOSER_DETERMINE_ROOT_VERSION_WORKING_DIRECTORY}" + +if [[ ! -d ${workingDirectory} ]]; then + echo "::error::The value for the \"working-directory\" input needs to be an existing directory. The directory \"${workingDirectory}\" does not exist." + + exit 1; +fi + +pathToComposerJsonFile="${COMPOSER_DETERMINE_ROOT_VERSION_WORKING_DIRECTORY}/composer.json" + +if [[ ! -f "${pathToComposerJsonFile}" ]]; then + echo "::error::A composer.json file could not be found in the directory \"${workingDirectory}\"." + + exit 1 +fi + +COMPOSER_ROOT_VERSION=$(jq --arg key "dev-${branch}" --raw-output '.["extra"]["branch-alias"][$key]' "${pathToComposerJsonFile}") + +if [[ null = "${COMPOSER_ROOT_VERSION}" ]]; then + echo "::error:A branch alias has not been defined in \"${pathToComposerJsonFile}\" for branch \"${branch}\"." + + exit 0 +fi + +echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> "${GITHUB_ENV}" diff --git a/actions/github/pull-request/add-assignee/action.yaml b/actions/github/pull-request/add-assignee/action.yaml index 9faf8fc..c3c1599 100644 --- a/actions/github/pull-request/add-assignee/action.yaml +++ b/actions/github/pull-request/add-assignee/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/issues#add-assignees-to-an-issue +# https://docs.github.com/en/rest/issues/assignees#add-assignees-to-an-issue # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run @@ -22,7 +22,7 @@ runs: steps: - name: "Determine pull request number" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -44,7 +44,7 @@ runs: core.setFailed(`Unable to determine the pull request number for event "${context.eventName}"`); - name: "Add assignee to pull request" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" env: ASSIGNEE: "${{ inputs.assignee }}" with: diff --git a/actions/github/pull-request/add-label-based-on-branch-name/action.yaml b/actions/github/pull-request/add-label-based-on-branch-name/action.yaml index d6439c2..c19114c 100644 --- a/actions/github/pull-request/add-label-based-on-branch-name/action.yaml +++ b/actions/github/pull-request/add-label-based-on-branch-name/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/issues#add-labels-to-an-issue +# https://docs.github.com/en/rest/issues/labels#add-labels-to-an-issue # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run @@ -19,7 +19,7 @@ runs: steps: - name: "Determine pull request number" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -35,7 +35,7 @@ runs: if (context.eventName == 'workflow_run') { core.exportVariable("PULL_REQUEST_NUMBER", context.payload.workflow_run.pull_requests[0].number); - core.exportVariable("PULL_REQUEST_NUMBER", context.payload.workflow_run.pull_requests[0].head.ref); + core.exportVariable("PULL_REQUEST_BRANCH_NAME", context.payload.workflow_run.pull_requests[0].head.ref); return; } @@ -43,7 +43,7 @@ runs: core.setFailed(`Unable to determine the pull request number and branch name for event "${context.eventName}"`); - name: "Add label to pull request based on branch name" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -66,7 +66,7 @@ runs: const matches = process.env.PULL_REQUEST_BRANCH_NAME.match(new RegExp('^([^/]+)\/')); - if (!matches instanceof Array) { + if (!Array.isArray(matches)) { return; } diff --git a/actions/github/pull-request/approve/action.yaml b/actions/github/pull-request/approve/action.yaml index 48c2df0..1706036 100644 --- a/actions/github/pull-request/approve/action.yaml +++ b/actions/github/pull-request/approve/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request +# https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run @@ -19,7 +19,7 @@ runs: steps: - name: "Determine pull request number" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -41,7 +41,7 @@ runs: core.setFailed(`Unable to determine the pull request number for event "${context.eventName}"`); - name: "Approve pull request" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | diff --git a/actions/github/pull-request/merge/action.yaml b/actions/github/pull-request/merge/action.yaml index e242d00..c919bd8 100644 --- a/actions/github/pull-request/merge/action.yaml +++ b/actions/github/pull-request/merge/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/pulls#merge-a-pull-request +# https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run @@ -23,7 +23,7 @@ runs: steps: - name: "Determine pull request number" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v7.0.1" with: github-token: "${{ inputs.github-token }}" script: | @@ -45,7 +45,7 @@ runs: core.setFailed(`Unable to determine the pull request number for event "${context.eventName}"`); - name: "Merge pull request" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v7.0.1" env: MERGE_METHOD: "${{ inputs.merge-method }}" with: diff --git a/actions/github/pull-request/request-review/action.yaml b/actions/github/pull-request/request-review/action.yaml index 64ffb22..e134fb8 100644 --- a/actions/github/pull-request/request-review/action.yaml +++ b/actions/github/pull-request/request-review/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/pulls#request-reviewers-for-a-pull-request +# https://docs.github.com/en/rest/pulls/review-requests#request-reviewers-for-a-pull-request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run @@ -22,7 +22,7 @@ runs: steps: - name: "Determine pull request number" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -44,7 +44,7 @@ runs: core.setFailed(`Unable to determine the pull request number for event "${context.eventName}"`); - name: "Request reviewer" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" env: REVIEWER: "${{ inputs.reviewer }}" with: diff --git a/actions/github/release/create/action.yaml b/actions/github/release/create/action.yaml index 1db5396..1c90e25 100644 --- a/actions/github/release/create/action.yaml +++ b/actions/github/release/create/action.yaml @@ -1,7 +1,7 @@ # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://docs.github.com/en/rest/reference/releases#create-a-release +# https://docs.github.com/en/rest/releases/releases#create-a-release # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push name: "Create a release" @@ -9,6 +9,10 @@ name: "Create a release" description: "Creates a release" inputs: + draft: + description: "Whether to create a draft or a published release" + required: false + default: "false" github-token: description: "GitHub token of a user with permission to create a release" required: true @@ -23,7 +27,7 @@ runs: shell: "bash" - name: "Create release" - uses: "actions/github-script@v6.0.0" + uses: "actions/github-script@v8.0.0" with: github-token: "${{ inputs.github-token }}" script: | @@ -34,8 +38,8 @@ runs: } try { - await github.rest.repos.createRelease({ - draft: false, + const response = await github.rest.repos.createRelease({ + draft: ${{ fromJSON(inputs.draft) }}, generate_release_notes: true, name: process.env.RELEASE_TAG, owner: context.repo.owner, @@ -44,6 +48,7 @@ runs: tag_name: process.env.RELEASE_TAG, }); + core.exportVariable('RELEASE_HTML_URL', response.data.html_url); core.exportVariable('RELEASE_ID', response.data.id); core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); } catch (error) { diff --git a/actions/github/release/publish/action.yaml b/actions/github/release/publish/action.yaml new file mode 100644 index 0000000..f9615b3 --- /dev/null +++ b/actions/github/release/publish/action.yaml @@ -0,0 +1,37 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://docs.github.com/en/rest/releases/releases#update-a-release +# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push + +name: "Publish a release" + +description: "Publishes a release" + +inputs: + github-token: + description: "GitHub token of a user with permission to publish a release" + required: true + release-id: + description: "The release identifier" + required: true + +runs: + using: "composite" + + steps: + - name: "Publish release" + uses: "actions/github-script@v7.0.1" + with: + github-token: "${{ inputs.github-token }}" + script: | + try { + const response = await github.rest.repos.updateRelease({ + draft: false, + owner: context.repo.owner, + release_id: ${{ inputs.release-id }}, + repo: context.repo.repo, + }); + } catch (error) { + core.setFailed(error.message); + } diff --git a/actions/oh-dear/check/request-run/action.yaml b/actions/oh-dear/check/request-run/action.yaml new file mode 100644 index 0000000..7ad7509 --- /dev/null +++ b/actions/oh-dear/check/request-run/action.yaml @@ -0,0 +1,28 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://ohdear.app/docs/integrations/api/checks#enable-amp-disable-a-check + +name: "Request a check run" + +description: "Request a check run" + +inputs: + oh-dear-api-token: + description: "Oh Dear API token of a user with permission to request a check run" + required: true + oh-dear-check-id: + description: "Check identifer of an Oh Dear check for which to request a run" + required: true + +runs: + using: "composite" + + steps: + - name: "Request a check run on ohdear.app" + run: | + curl -X POST "https://ohdear.app/api/checks/${{ inputs.oh-dear-check-id }}/request-run" \ + -H "Authorization: Bearer ${{ inputs.oh-dear-api-token }}" \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" + shell: "bash" diff --git a/actions/oh-dear/maintenance-period/start/action.yaml b/actions/oh-dear/maintenance-period/start/action.yaml new file mode 100644 index 0000000..644c42b --- /dev/null +++ b/actions/oh-dear/maintenance-period/start/action.yaml @@ -0,0 +1,28 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://ohdear.app/docs/integrations/api/maintenance-windows#creating-a-new-maintenance-period-on-demand + +name: "Starts maintenance period" + +description: "Starts maintenance period" + +inputs: + oh-dear-api-token: + description: "Oh Dear API token of a user with permission to start maintenance period" + required: true + oh-dear-site-id: + description: "Site identifer of an Oh Dear site for which to start a maintenance period" + required: true + +runs: + using: "composite" + + steps: + - name: "Start maintenance period on ohdear.app" + run: | + curl -X POST https://ohdear.app/api/sites/${{ inputs.oh-dear-site-id }}/start-maintenance \ + -H "Authorization: Bearer ${{ inputs.oh-dear-api-token }}" \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" + shell: "bash" diff --git a/actions/oh-dear/maintenance-period/stop/action.yaml b/actions/oh-dear/maintenance-period/stop/action.yaml new file mode 100644 index 0000000..f91173d --- /dev/null +++ b/actions/oh-dear/maintenance-period/stop/action.yaml @@ -0,0 +1,28 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://ohdear.app/docs/integrations/api/maintenance-windows#creating-a-new-maintenance-period-on-demand + +name: "Starts maintenance period" + +description: "Starts maintenance period" + +inputs: + oh-dear-api-token: + description: "Oh Dear API token of a user with permission to start maintenance period" + required: true + oh-dear-site-id: + description: "Site identifer of an Oh Dear site for which to start a maintenance period" + required: true + +runs: + using: "composite" + + steps: + - name: "Stop maintenance period on ohdear.app" + run: | + curl -X POST https://ohdear.app/api/sites/${{ inputs.oh-dear-site-id }}/stop-maintenance \ + -H "Authorization: Bearer ${{ inputs.oh-dear-api-token }}" \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" + shell: "bash" diff --git a/actions/phive/install/action.yaml b/actions/phive/install/action.yaml new file mode 100644 index 0000000..2261c0c --- /dev/null +++ b/actions/phive/install/action.yaml @@ -0,0 +1,39 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://phar.io + +name: "Install dependencies with phive" + +description: "Installs dependencies with phive" + +inputs: + phive-home: + default: ".build/phive" + description: "Which directory to use as PHIVE_HOME directory" + required: false + trust-gpg-keys: + default: "" + description: "A comma-separated list of trusted GPG keys" + required: true + +runs: + using: "composite" + + steps: + - name: "Create phive home directory" + run: "mkdir -p ${{ inputs.phive-home }}" + shell: "bash" + + - name: "Cache dependencies installed with phive" + uses: "actions/cache@v4.3.0" + with: + path: "${{ inputs.phive-home }}" + key: "phive-${{ hashFiles('**/phars.xml') }}" + restore-keys: "phive-" + + - name: "Install dependencies with phive" + env: + PHIVE_HOME: "${{ inputs.phive-home }}" + run: "phive install --trust-gpg-keys ${{ inputs.trust-gpg-keys }}" + shell: "bash" diff --git a/profile/README.md b/profile/README.md index 48fe6b3..c4c419c 100644 --- a/profile/README.md +++ b/profile/README.md @@ -1,5 +1 @@ :wave: - -Do you like what you see? - -Consider [sponsoring @localheinz](https://github.com/sponsors/localheinz), who maintains these fine packages!