fluffychat/.github/workflows/check_duplicates.yaml
dependabot[bot] 85500e76c2
build: (deps): bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-20 21:08:45 +00:00

29 lines
No EOL
1.1 KiB
YAML

name: Check duplicates
on:
issues:
types: [opened]
jobs:
check_duplicates:
runs-on: ubuntu-latest
env:
title: ${{ github.event.issue.title }}
author: ${{ github.event.issue.user.login }}
number: ${{ github.event.issue.number }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v6
- name: Check duplicates
run: |
title=$(printf %q "${{ env.title }}")
issues=$(gh issue list --search '${{ title }}' --json number,title,url)
number=${{ env.number }}
issues_filtered=$(echo "$issues" | jq --arg num "$number" 'map(select(.number != ($num | tonumber)))')
if [ "$(echo "$issues_filtered" | jq length)" -eq 0 ]; then
echo "No duplicates found."
else
issues_markdown=$(echo "$issues_filtered" | jq -r '.[] | "- [" + .title + "](" + .url + ")"')
formatted_body=$(echo -e "@${{ env.author }}\nPossible duplication of:\n$issues_markdown")
gh issue comment ${{ github.event.issue.number }} --body "$formatted_body"
fi