print supported protocols #1
Workflow file for this run
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
name: "pr_opened" | |
on: | |
pull_request_target: | |
types: | |
- opened | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check linked issue | |
id: linked-issues | |
uses: nearform-actions/[email protected] | |
continue-on-error: true | |
with: | |
comment: "" | |
- name: Check mentioned issue | |
id: mentioned-issues | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: string | |
script: | | |
const pattern1 = new RegExp( | |
String.raw`(^|\s)(#|gh-|roc-streaming/[\w-]+#)\d+($|\s)`, "i"); | |
const pattern2 = new RegExp( | |
String.raw`(^|\s)https?://github.com/roc-streaming/[\w-]+/issues/\d+($|\s)`, "i"); | |
const body = context.payload.pull_request.body; | |
return pattern1.test(body) || pattern2.test(body) ? "true" : "false"; | |
- name: Echo results | |
run: | | |
echo "linked-issues: ${{ steps.linked-issues.outputs.issues }}" | |
echo "mentioned-issues: ${{ steps.mentioned-issues.outputs.result }}" | |
- name: Post Comment | |
if: | | |
steps.linked-issues.outputs.issues == '[]' && | |
steps.mentioned-issues.outputs.result == 'false' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: ":robot: Upon creation, pull request description does not have a link to an issue. | |
If there is a related issue, please add it to the description | |
using any of the [supported formats](https://docs.github.com/en/get-started/\ | |
writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls)." |