From af1c6dcc8bd5ae695f95187bd64df3c7805b742a Mon Sep 17 00:00:00 2001 From: Mariot Tsitoara Date: Tue, 24 Mar 2026 06:41:43 +0100 Subject: [PATCH] [all] feat(ci): check if linked issues are present (#187) --- .github/workflows/check-linked-issues.yml | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/check-linked-issues.yml diff --git a/.github/workflows/check-linked-issues.yml b/.github/workflows/check-linked-issues.yml new file mode 100644 index 00000000..822688d7 --- /dev/null +++ b/.github/workflows/check-linked-issues.yml @@ -0,0 +1,32 @@ +name: Check linked issues + +on: + pull_request_target: + branches: [main] + types: [opened, edited, reopened, synchronize] + +jobs: + check-pr-issue: + name: Check Pull Request is linked to an issue + if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') }} + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Check for linked issues + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + run: | + # Get PR details including linked issues + LINKED_ISSUES=$(gh pr view $PR_NUMBER --repo $REPO --json closingIssuesReferences --jq '.closingIssuesReferences | length') + + if [ "$LINKED_ISSUES" -eq 0 ]; then + echo "::error::No linked issues found. Please link at least one issue to this Pull Request." + echo "You can link an issue by using keywords like 'Fixes #123', 'Closes #123', or 'Resolves #123' in the PR description." + exit 1 + else + echo "✓ Found $LINKED_ISSUES linked issue(s)" + fi