diff --git a/CHANGELOG.md b/CHANGELOG.md index e7ff47b..ef6324d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), For a full diff see [`1.6.0...main`][1.6.0...main]. +### 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]. @@ -154,5 +158,6 @@ For a full diff see [`1.0.0...main`][1.0.0...main]. [#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 [@localheinz]: https://github.com/localheinz diff --git a/README.md b/README.md index 68bd4b1..f47c5c4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This repository provides the following composite actions: - [`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/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) @@ -516,6 +517,52 @@ none A release is created 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@v3.0.2" + with: + fetch-depth: 50 + + - name: "Request broken links check on ohdear.app" + uses: "ergebnis/.github/actions/oh-dear/maintenance-period/start@1.7.0" + 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). 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"