Skip to content

ci(dependabot): auto merge pull requests #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
interval: weekly
commit-message:
prefix: ci(deps)
- package-ecosystem: terraform
Expand All @@ -13,3 +13,7 @@ updates:
interval: monthly
commit-message:
prefix: chore(deps)
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-major
48 changes: 48 additions & 0 deletions .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: auto-merge
on:
pull_request:
permissions:
contents: write
pull-requests: write
jobs:
check-can-auto-merge:
if: github.triggering_actor == 'dependabot[bot]'
name: Check if PR can be auto-merged
runs-on: ubuntu-latest
outputs:
can-auto-merge: ${{ steps.can-auto-merge.outputs.approve }}
steps:
- uses: dependabot/fetch-metadata@v2.2.0
id: dependabot-metadata
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- if: |
steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' ||
steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions'
id: can-auto-merge
run: echo "approve=true" >> $GITHUB_OUTPUT
auto-merge:
needs: check-can-auto-merge
if: needs.check-can-auto-merge.outputs.can-auto-merge == 'true'
name: Auto merge pull requests
runs-on: ubuntu-latest
steps:
- uses: dependabot/fetch-metadata@v2.2.0
id: dependabot-metadata
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve Dependabot PR
run: gh pr review --approve "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
# Because we enforce PRs be approved by a code owner, a token from the
# operations team must be used to approve the PR. This token is from the
# StatusCake machine account which has been given membership to the
# operations team.
GITHUB_TOKEN: ${{ secrets.MACHINE_TOKEN }}
- name: Enable auto-merge for Dependabot PR
run: gh pr merge --auto --merge "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# vi: ft=yaml
---
formatter:
type: basic
# There is a "bug" with the behaviour of this option that will move file head
# comments below the initial document start. For example front matter is
# rearraged and therefore misplaced in the file. This behaviour prevents
# `ymalfmt` from being run in CI or automatically in code editors.
include_document_start: true
indentless_arrays: true
pad_line_comments: 2
# There is missing functionality in `yamlfmt` to remove redundantly quoted
# strings from YAML documents, and prefer the use of double quotes (or
# whatever is configured). This means further manual effort is required to
# correct files.
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
---
extends: default
rules:
document-start:
level: error
indentation:
indent-sequences: false
spaces: 2
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ reported by contacting the [project team](mailto:support@statuscake.com). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
incident. Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
Expand Down
55 changes: 27 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
# How To Contribute

Contributions are welcome as we strive to make this application as useful as
possible for everyone. However time is not always on our side, and changes may
not be reviewed or merged in a timely manner.
Contributions are welcome as we strive to make this module as useful as possible
for everyone. However time is not always on our side, and changes may not be
reviewed or merged in a timely manner.

If this application is found to be missing in functionality, please open an
issue describing the proposed change - discussing changes ahead of time reduces
If this module is found to be missing in functionality, please open an issue
describing the proposed change - discussing changes ahead of time reduces
friction within pull requests.

## Making Changes
## Prerequisites

You will need the following things properly installed on your computer:

- [Git](https://git-scm.com/)
- [Terraform](https://www.terraform.io/) (1.0+)
- [Make](https://en.wikipedia.org/wiki/Make_(software)) (optional)

Begin by creating a new branch. It is appreciated if branch names are written
using kebab-case.
## Installation

```bash
git checkout master
git pull --rebase
git checkout -b my-new-feature
```
- `git clone <repository-url>` this repository
- `cd statuscake-monitoring-suite`

Make the desired change, and ensure both the linter and test suite continue to
pass. Once this requirement is met push the change back to a fork of this
repository.
## Validating

```bash
git push -u origin my-new-feature
```
- `terraform validate`

> **Note**
> The equivalent `make` target to validate changes is as follows: `make
> validate`. This additionally initialises the workspace.

## Making Changes

Finally open a pull request through the GitHub UI. Upon doing this the CI suite
will be run to ensure changes do not break current functionality.
For additional contributing guidelines visit
[devhandbook.org](https://devhandbook.org/contributing)

Changes are more likely to be approve if they:
## Further Reading / Useful Links

- Include tests for new functionality,
- Are accompanied with a [good commit
message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
- Contain few commits (preferably a single commit),
- Do not contain merge commits,
- Maintain backward compatibility.
- [Terraform](https://www.terraform.io/)