diff --git a/.editorconfig b/.editorconfig index 85801ed..ee30834 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,6 @@ root = true - [*] end_of_line = lf charset = utf-8 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ff6b65c..17b283d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,28 +10,31 @@ assignees: '' A clear and concise description of what the bug is. **To Reproduce** -Steps to reproduce the behavior: +Steps to reproduce the behaviour: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error -**Expected behavior** +**Expected behaviour** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml new file mode 100644 index 0000000..01b17b6 --- /dev/null +++ b/.github/workflows/auto-merge.yaml @@ -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 }} diff --git a/.github/workflows/policy.yaml b/.github/workflows/policy.yaml index c53c3b1..d6fcb1d 100644 --- a/.github/workflows/policy.yaml +++ b/.github/workflows/policy.yaml @@ -42,10 +42,22 @@ jobs: node-version: 19.x - name: Install base config run: npm install @commitlint/config-conventional - - name: Validate all commits + - name: Validate commit messages run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD --verbose - yamllint: - name: Lint YAML documents + markdown-style: + name: Check markdown style + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 19.x + - name: Validate markdown + run: npx markdownlint-cli2 **/*.md + yaml-style: + name: Check YAML style runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -54,5 +66,5 @@ jobs: python-version: "3.10" - name: Install yamllint run: pip install --user yamllint - - name: Lint + - name: Validate YAML run: yamllint . diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 0000000..a4c6c19 --- /dev/null +++ b/.markdownlint.jsonc @@ -0,0 +1,6 @@ +{ + "default": true, + "line-length": { + "tables": false + } +} diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 0000000..b8d8b5c --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,17 @@ +# vi: ft=yaml +--- +exclude: +- .bundle/ +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. diff --git a/.yamllint b/.yamllint index 8ac36af..6797707 100644 --- a/.yamllint +++ b/.yamllint @@ -4,6 +4,8 @@ extends: default ignore: | .bundle/ rules: + document-start: + level: error indentation: indent-sequences: false spaces: 2 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index ca730f6..6a2dd4e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -5,30 +5,30 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. +size, disability, ethnicity, gender identity and expression, level of +experience, nationality, personal appearance, race, religion, or sexual identity +and orientation. ## Our Standards Examples of behaviour that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behaviour by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities @@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable behaviour and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behaviour. -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviours that they deem inappropriate, -threatening, offensive, or harmful. +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviours that they deem inappropriate, threatening, +offensive, or harmful. ## Scope @@ -55,11 +55,12 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behaviour may be -reported by contacting the project team at support@statuscake.com. All +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 separately. +obligated to maintain confidentiality with regard to the reporter of an +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 faith may face temporary or permanent repercussions as determined by other @@ -67,8 +68,8 @@ members of the project's leadership. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5215053..1f8b870 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,45 +8,23 @@ If this package 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. -## Installation +## Prerequisites + +You will need the following things properly installed on your computer: -* `git clone ` this repository -* `cd statuscake-rb` +- [Git](https://git-scm.com/) +- [Ruby](https://www.ruby-lang.org/en/) (2.4+) -## Linting +## Installation -* `bundle exec rubocop` +- `git clone ` this repository +- `cd statuscake-rb` ## Running tests -* `bundle exec rake spec` +- `bundle exec rake spec` ## Making Changes -Begin by creating a new branch. It is appreciated if branch names are written -using kebab-case. - -```bash -git checkout master -git pull --rebase -git checkout -b my-new-feature -``` - -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. - -```bash -git push -u origin my-new-feature -``` - -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. - -Changes are more likely to be approve if they: - -- 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. +See the contributing guide at +[devhandbook.org](https://devhandbook.org/contributing) diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md index 2a3b3cc..7e3af53 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ can be found [here](https://www.statuscake.com/api/v1). ## Prerequisites -You will need the following things properly installed on your computer. +You will need the following things properly installed on your computer: -* [Ruby](https://www.ruby-lang.org/en/): any one of the **three latest major** +- [Ruby](https://www.ruby-lang.org/en/): any one of the **three latest major** [releases](https://www.ruby-lang.org/en/downloads/) ## Installation @@ -28,13 +28,13 @@ gem 'statuscake-rb' And then execute: ```bash -$ bundle install +bundle install ``` Or install it yourself: ```bash -$ gem install statuscake-rb +gem install statuscake-rb ``` ### GitHub @@ -42,10 +42,10 @@ $ gem install statuscake-rb Installing the latest version from GitHub: ```bash -$ git clone https://github.com/StatusCakeDev/statuscake-rb -$ cd statuscake-rb -$ bundle install -$ bundle exec rake install +git clone https://github.com/StatusCakeDev/statuscake-rb +cd statuscake-rb +bundle install +bundle exec rake install ``` ## Usage @@ -68,4 +68,4 @@ service.list_uptime_tests(opts) ## License -This project is licensed under the [MIT License](LICENSE.md). +This project is licensed under the [MIT License](LICENSE).