From 613887fab3a738042a275b746a23c6f950377dc7 Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Sun, 5 Nov 2023 02:12:32 +0400 Subject: [PATCH 1/2] Update gh actions --- .github/workflows/assign_project.yml | 3 +- .github/workflows/build.yml | 1 + .github/workflows/lint_pr.yml | 44 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lint_pr.yml diff --git a/.github/workflows/assign_project.yml b/.github/workflows/assign_project.yml index 3b40c88e5..dbcde68e8 100644 --- a/.github/workflows/assign_project.yml +++ b/.github/workflows/assign_project.yml @@ -2,7 +2,8 @@ name: "assign project" on: issues: - types: [opened] + types: + - opened jobs: assign-project: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67802065d..fe0ebada0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,7 @@ on: branches: - master - develop + - feature/* tags: - v* diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml new file mode 100644 index 000000000..a193492f9 --- /dev/null +++ b/.github/workflows/lint_pr.yml @@ -0,0 +1,44 @@ +name: "lint pr" + +on: + pull_request: + types: + - opened + +jobs: + + lint: + runs-on: ubuntu-latest + steps: + + - name: Check linked issue + id: linked-issues + uses: nearform-actions/github-action-check-linked-issues@v1 + continue-on-error: true + with: + comment: 0 + + - name: Check mentioned issue + id: mentioned-issues + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const pattern1 = /(^|\s)(#|gh-|roc-streaming/[\w-]+#)\d+($|\s)/i; + const pattern2 = /(^|\s)https?://github.com/roc-streaming/[\w-]+/issues/\d+($|\s)/i; + const body = github.context.payload.pull_request.body; + return pattern1.test(body) || pattern2.test(body); + + - name: Post Comment + if: | + steps.linked-issues.outputs.linked_issues_count == 0 && + steps.mentioned-issues.outputs.result == false + uses: actions/github-script@v6 + with: + script: | + github.issues.createComment({ + owner: github.context.repo.owner, + repo: github.context.repo.repo, + issue_number: github.context.payload.pull_request.number, + body: 'Test comment.' + }) From 184adae4ad1b824ecb94def7e809d553992ed80f Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Sun, 5 Nov 2023 02:38:10 +0400 Subject: [PATCH 2/2] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6a125f72e..b9eff04ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# build results +# build resultsx /bin /build /docs/html