Skip to content

Commit 74a0f25

Browse files
authored
Merge pull request #123 from ergebnis/feature/oh-dear-maintenance-period
Enhancement: Add composite actions for starting and stopping maintenance periods on Oh Dear
2 parents 6c33720 + 4a2f3a5 commit 74a0f25

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
For a full diff see [`1.5.1...main`][1.5.1...main].
1010

11+
### Added
12+
13+
- 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]
14+
1115
## [`1.5.1`][1.5.1]
1216

1317
For a full diff see [`1.5.0...1.5.1`][1.5.0...1.5.1].
@@ -143,5 +147,6 @@ For a full diff see [`1.0.0...main`][1.0.0...main].
143147
[#82]: https://github.com/ergebnis/.github/pull/82
144148
[#87]: https://github.com/ergebnis/.github/pull/87
145149
[#96]: https://github.com/ergebnis/.github/pull/96
150+
[#123]: https://github.com/ergebnis/.github/pull/123
146151

147152
[@localheinz]: https://github.com/localheinz

README.md

+94
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ This repository provides the following composite actions:
2222
- [`ergebnis/.github/actions/github/pull-request/merge`](#github-pull-request-merge)
2323
- [`ergebnis/.github/actions/github/pull-request/request-review`](#github-pull-request-review)
2424
- [`ergebnis/.github/actions/github/release/create`](#github-release-create)
25+
- [`ergebnis/.github/actions/oh-dear/maintenance-period/start`](#oh-dear-maintenance-period-start)
26+
- [`ergebnis/.github/actions/oh-dear/maintenance-period/stop`](#oh-dear-maintenance-period-stop)
2527

2628
### <a name="composer-determine-cache-directory"> `ergebnis/.github/actions/composer/determine-cache-directory`
2729

@@ -514,6 +516,98 @@ none
514516

515517
A release is created by the user who owns the GitHub token specified with the `github-token` input.
516518

519+
### <a name="oh-dear-maintenance-period-start"> `ergebnis/.github/actions/oh-dear/maintenance-period/start`
520+
521+
This action starts a [maintenance period](https://ohdear.app/docs/general/maintenance-windows) on [Oh Dear!](https://ohdear.app).
522+
523+
```yaml
524+
name: "Deploy"
525+
526+
on:
527+
push:
528+
branches:
529+
- "main"
530+
531+
jobs:
532+
deploy:
533+
name: "Deploy"
534+
535+
runs-on: "ubuntu-latest"
536+
537+
steps:
538+
- name: "Checkout"
539+
uses: "actions/checkout@v3.0.2"
540+
with:
541+
fetch-depth: 50
542+
543+
- name: "Start maintenance period on ohdear.app"
544+
uses: "ergebnis/.github/actions/oh-dear/maintenance-period/start@1.5.1"
545+
with:
546+
oh-dear-api-token: "${{ secrets.OH_DEAR_API_TOKEN }}"
547+
oh-dear-site-id: "${{ secrets.OH_DEAR_SITE_ID }}"
548+
```
549+
550+
For details, see [`actions/oh-dear/maintenance-period/start/action.yaml`](actions/oh-dear/maintenance-period/start/action.yaml).
551+
552+
#### Inputs
553+
554+
- `oh-dear-api-token`, required: The Oh Dear API token of a user with permission to start a maintenance period
555+
- `oh-dear-site-id`, required: Site identifer of an Oh Dear site for which to start a maintenance period
556+
557+
#### Outputs
558+
559+
none
560+
561+
#### Side Effects
562+
563+
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.
564+
565+
### <a name="oh-dear-maintenance-period-stop"> `ergebnis/.github/actions/oh-dear/maintenance-period/stop`
566+
567+
This action stops a [maintenance period](https://ohdear.app/docs/general/maintenance-windows) on [Oh Dear!](https://ohdear.app).
568+
569+
```yaml
570+
name: "Deploy"
571+
572+
on:
573+
push:
574+
branches:
575+
- "main"
576+
577+
jobs:
578+
deploy:
579+
name: "Deploy"
580+
581+
runs-on: "ubuntu-latest"
582+
583+
steps:
584+
- name: "Checkout"
585+
uses: "actions/checkout@v3.0.2"
586+
with:
587+
fetch-depth: 50
588+
589+
- name: "Stop maintenance period on ohdear.app"
590+
uses: "ergebnis/.github/actions/oh-dear/maintenance-period/stop@1.5.1"
591+
with:
592+
oh-dear-api-token: "${{ secrets.OH_DEAR_API_TOKEN }}"
593+
oh-dear-site-id: "${{ secrets.OH_DEAR_SITE_ID }}"
594+
```
595+
596+
For details, see [`actions/oh-dear/maintenance-period/stop/action.yaml`](actions/oh-dear/maintenance-period/stop/action.yaml).
597+
598+
#### Inputs
599+
600+
- `oh-dear-api-token`, required: The Oh Dear API token of a user with permission to stop a maintenance period
601+
- `oh-dear-site-id`, required: Site identifer of an Oh Dear site for which to stop a maintenance period
602+
603+
#### Outputs
604+
605+
none
606+
607+
#### Side Effects
608+
609+
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.
610+
517611
## Changelog
518612

519613
Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
2+
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
3+
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
4+
# https://ohdear.app/docs/integrations/api/maintenance-windows#creating-a-new-maintenance-period-on-demand
5+
6+
name: "Starts maintenance period"
7+
8+
description: "Starts maintenance period"
9+
10+
inputs:
11+
oh-dear-api-token:
12+
description: "Oh Dear API token of a user with permission to start maintenance period"
13+
required: true
14+
oh-dear-site-id:
15+
description: "Site identifer of an Oh Dear site for which to start a maintenance period"
16+
required: true
17+
18+
runs:
19+
using: "composite"
20+
21+
steps:
22+
- name: "Start maintenance period on ohdear.app"
23+
run: |
24+
curl -X POST https://ohdear.app/api/sites/${{ inputs.oh-dear-site-id }}/start-maintenance \
25+
-H "Authorization: Bearer ${{ inputs.oh-dear-api-token }}" \
26+
-H "Accept: application/json" \
27+
-H "Content-Type: application/json"
28+
shell: "bash"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
2+
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
3+
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
4+
# https://ohdear.app/docs/integrations/api/maintenance-windows#creating-a-new-maintenance-period-on-demand
5+
6+
name: "Starts maintenance period"
7+
8+
description: "Starts maintenance period"
9+
10+
inputs:
11+
oh-dear-api-token:
12+
description: "Oh Dear API token of a user with permission to start maintenance period"
13+
required: true
14+
oh-dear-site-id:
15+
description: "Site identifer of an Oh Dear site for which to start a maintenance period"
16+
required: true
17+
18+
runs:
19+
using: "composite"
20+
21+
steps:
22+
- name: "Stop maintenance period on ohdear.app"
23+
run: |
24+
curl -X POST https://ohdear.app/api/sites/${{ inputs.oh-dear-site-id }}/stop-maintenance \
25+
-H "Authorization: Bearer ${{ inputs.oh-dear-api-token }}" \
26+
-H "Accept: application/json" \
27+
-H "Content-Type: application/json"
28+
shell: "bash"

0 commit comments

Comments
 (0)