From f81ffa9fa6084d40b7cc479cc27f6b5f2a3bb777 Mon Sep 17 00:00:00 2001 From: edwardysun Date: Fri, 1 Nov 2024 21:05:21 +0000 Subject: [PATCH] Check for linear in PR description (#5216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Fixes https://linear.app/thirdweb/issue/ENG-2/better-enforce-linear-use --- ## PR-Codex overview This PR introduces a GitHub Actions workflow to check the pull request body for specific keywords ("CNCT" or "DASH"). If these keywords are found, it confirms a linked issue; otherwise, it fails the check. ### Detailed summary - Added a workflow named `Check for "linear" in pull request body` in `.github/workflows/linear.yml`. - Configured the workflow to trigger on `pull_request` events (opened and edited). - Implemented a job `check_linear_in_pr_body` to verify the presence of keywords in the PR body. - Utilized `curl` to fetch the PR body and `grep` to search for keywords. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .github/workflows/linear.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/linear.yml diff --git a/.github/workflows/linear.yml b/.github/workflows/linear.yml new file mode 100644 index 00000000000..7b79987a90b --- /dev/null +++ b/.github/workflows/linear.yml @@ -0,0 +1,26 @@ +name: Check for "linear" in pull request body + +on: + pull_request: + types: + - opened + - edited + +jobs: + check_linear_in_pr_body: + runs-on: ubuntu-latest + steps: + - name: Check for linked issue in pull request body + run: | + pr_body=$(curl -s \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }} | jq -r .body) + + echo "Pull Request Body: $pr_body" + + if echo "$pr_body" | grep -iE "CNCT|DASH"; then + echo "Linked issue found in the pull request body." + else + echo "No linked issue found in the pull request body." + exit 1 + fi