-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ee28e8
commit e0a8ba8
Showing
11 changed files
with
283 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
extends: | ||
- "@open-turo/commitlint-config-conventional" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"maxHeaderWidth": 72, | ||
"path": "cz-conventional-changelog" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: open-turo/actions-gha/lint@v1 | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: open-turo/actions-gha/test@v1 | ||
|
||
unit-test: | ||
name: Unit test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v3 | ||
- name: Introduce problem that needs resolution | ||
run: echo "fixme" > ./badshell.sh | ||
- name: Create temporary pull request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
title: Temp PR for unit testing purposes | ||
base: main | ||
branch: pr-for-unit-testing | ||
branch-suffix: timestamp | ||
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }} | ||
draft: true | ||
- name: Verify new PR created | ||
run: | | ||
echo "PR ${{ steps.cpr.outputs.pull-request-number }} created" | ||
echo "PR operation '${{ steps.cpr.outputs.pull-request-operation}}'" | ||
- name: Cleanup temporary pull request | ||
if: | ||
always() && ${{ steps.cpr.outputs.pull-request-operation}} == | ||
'created' && ${{ steps.cpr.outputs.pull-request-number }} != '' | ||
uses: peter-evans/close-pull@v2 | ||
with: | ||
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | ||
comment: | ||
Auto-closing temporary PR ${{ steps.cpr.outputs.pull-request-number | ||
}} | ||
delete-branch: true | ||
token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: open-turo/actions-gha/lint@v1 | ||
with: | ||
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }} | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: open-turo/actions-gha/test@v1 | ||
with: | ||
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }} | ||
|
||
release: | ||
needs: | ||
- lint | ||
- test | ||
name: Release | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }} | ||
steps: | ||
- uses: open-turo/actions-gha/release@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
exclude: dist/.* | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 # Use the ref you want to point at | ||
hooks: | ||
- id: check-json | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: v8.9.0 | ||
hooks: | ||
- id: eslint | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.5.1 | ||
hooks: | ||
- id: prettier | ||
stages: [commit] | ||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook | ||
rev: v8.0.0 | ||
hooks: | ||
- id: commitlint | ||
stages: [commit-msg] | ||
additional_dependencies: ["@open-turo/commitlint-config-conventional"] | ||
- repo: https://github.com/rhysd/actionlint | ||
rev: v1.6.8 | ||
hooks: | ||
- id: actionlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"singleQuote": false, | ||
"printWidth": 80, | ||
"proseWrap": "always", | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"semi": false, | ||
"overrides": [ | ||
{ | ||
"files": ["*.json", "*.yml", "*.yaml"], | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"branches": [ | ||
"main", | ||
{ | ||
"channel": "next", | ||
"name": "(f|b|c)/*", | ||
"prerelease": "beta-<%= (/^\\w+-\\d+/.exec(name.substr(2)) || [])[0] %>" | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,64 @@ | ||
# action-conditional-pr-comment | ||
GitHub Action that supports instructing the author of a Pull Request (PR) how to resolve a given problem within the context of a PR. Conditionally adds a comment to the PR with resolution instructions, and once the condition is found to be resolved, allows the previously added comment, if one exists at that time, to be removed from the PR. | ||
# `open-turo/action-conditional-pr-comment` | ||
|
||
GitHub Action that supports instructing the author of a Pull Request (PR) how to | ||
resolve a given problem within the context of a PR. Conditionally adds a comment | ||
to the PR with resolution instructions, and once the condition is found to be | ||
resolved, allows the previously added comment, if one exists at that time, to be | ||
removed from the PR. | ||
|
||
## Usage | ||
|
||
### Instruct PR author to run npm run prepare, delete PR comment upon resolution | ||
|
||
```yaml | ||
jobs: | ||
do-something: | ||
steps: | ||
- name: Do something ... | ||
- uses: open-turo/action-conditional-pr-comment@v1 | ||
with: | ||
instruction-text: | ||
Please run `npm run prepare` locally, then push those | ||
changes to this PR | ||
instruction-text-detector: "npm run prepare" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
### Instruct PR author to run npm run prepare, retain PR comment upon resolution | ||
```yaml | ||
jobs: | ||
do-something: | ||
steps: | ||
- name: Do something ... | ||
- uses: open-turo/action-conditional-pr-comment@v1 | ||
with: | ||
instruction-text: | ||
Please run `npm run prepare` locally, then push those | ||
changes to this PR | ||
instruction-text-detector: "npm run prepare" | ||
delete-comment-on-resolution: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
## Inputs | ||
| parameter | description | required | default | | ||
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- | | ||
| instruction-text | This is the full text of the message to be placed within a comment of the given PR to instruct the author of the PR how to resolve a given problem. | `true` | | | ||
| instruction-text-detector | This is some unique verbatim subset of the instruction-text that is to be used to determine if a comment has already been created against the PR that instructs the author how to resolve the given problem. | `true` | | | ||
| delete-comment-on-resolution | Whether or not to delete the comment that has been added to the PR upon problem resolution. | `true` | true | | ||
| github-token | GitHub token that can create/delete comments. e.g. 'secrets.GITHUB_TOKEN' | `true` | | | ||
|
||
## Runs | ||
|
||
This action is an `composite` action. | ||
|
||
## Get Help | ||
|
||
Please review Issues, post new Issues against this repository as needed. | ||
|
||
## Contributions | ||
|
||
Please see [here](https://github.com/open-turo/contributions) for guidelines on | ||
how to contribute to this project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Conditional PR comment | ||
description: | ||
GitHub Action that supports instructing the author of a Pull Request (PR) how | ||
to resolve a given problem within the context of a PR. Conditionally adds a | ||
comment to the PR with resolution instructions, and once the condition is | ||
found to be resolved, allows the previously added comment, if one exists at | ||
that time, to be removed from the PR. | ||
inputs: | ||
instruction-text: | ||
required: true | ||
description: | ||
This is the full text of the message to be placed within a comment of the | ||
given PR to instruct the author of the PR how to resolve a given problem. | ||
instruction-text-detector: | ||
required: true | ||
description: | ||
This is some unique verbatim subset of the instruction-text that is to be | ||
used to determine if a comment has already been created against the PR | ||
that instructs the author how to resolve the given problem. | ||
delete-comment-on-resolution: | ||
required: true | ||
description: | ||
Whether or not to delete the comment that has been added to the PR upon | ||
problem resolution. | ||
default: "true" | ||
github-token: | ||
required: true | ||
description: | ||
GitHub token that can create/delete comments. e.g. 'secrets.GITHUB_TOKEN' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: | ||
Check to see if problem resolution instructions comment already present | ||
on the PR | ||
uses: peter-evans/find-comment@v1 | ||
if: github.event_name == 'pull_request' | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: ${{ inputs.instruction-text-detector }} | ||
- name: Conditionally create instructions comment for PR author | ||
if: | ||
github.event_name == 'pull_request' && failure() && | ||
steps.fc.outputs.comment-id == '' | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: ${{ inputs.instruction-text}} | ||
- name: Delete instructions comment from PR if problem has been resolved | ||
if: | ||
inputs.delete-comment-on-resolution == 'true' && github.event_name == | ||
'pull_request' && success() && steps.fc.outputs.comment-id != '' | ||
uses: jungwinter/comment@v1 | ||
with: | ||
type: delete | ||
comment_id: ${{ steps.fc.outputs.comment-id }} | ||
token: ${{ inputs.github-token }} |