Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/github-script/releases">actions/github-script's releases</a>.</em></p> <blockquote> <h2>v8.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update Node.js version support to 24.x by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/637">actions/github-script#637</a></li> <li>README for updating actions/github-script from v7 to v8 by <a href="https://github.com/sneha-krip"><code>@sneha-krip</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/653">actions/github-script#653</a></li> </ul> <h2>⚠️ Minimum Compatible Runner Version</h2> <p><strong>v2.327.1</strong><br /> <a href="https://github.com/actions/runner/releases/tag/v2.327.1">Release Notes</a></p> <p>Make sure your runner is updated to this version or newer to use this release.</p> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/637">actions/github-script#637</a></li> <li><a href="https://github.com/sneha-krip"><code>@sneha-krip</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/653">actions/github-script#653</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/github-script/compare/v7.1.0...v8.0.0">https://github.com/actions/github-script/compare/v7.1.0...v8.0.0</a></p> <h2>v7.1.0</h2> <h2>What's Changed</h2> <ul> <li>Upgrade husky to v9 by <a href="https://github.com/benelan"><code>@benelan</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/482">actions/github-script#482</a></li> <li>Add workflow file for publishing releases to immutable action package by <a href="https://github.com/Jcambass"><code>@Jcambass</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/485">actions/github-script#485</a></li> <li>Upgrade IA Publish by <a href="https://github.com/Jcambass"><code>@Jcambass</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/486">actions/github-script#486</a></li> <li>Fix workflow status badges by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/497">actions/github-script#497</a></li> <li>Update usage of <code>actions/upload-artifact</code> by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/512">actions/github-script#512</a></li> <li>Clear up package name confusion by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/514">actions/github-script#514</a></li> <li>Update dependencies with <code>npm audit fix</code> by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/515">actions/github-script#515</a></li> <li>Specify that the used script is JavaScript by <a href="https://github.com/timotk"><code>@timotk</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/478">actions/github-script#478</a></li> <li>chore: Add Dependabot for NPM and Actions by <a href="https://github.com/nschonni"><code>@nschonni</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/472">actions/github-script#472</a></li> <li>Define <code>permissions</code> in workflows and update actions by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/531">actions/github-script#531</a></li> <li>chore: Add Dependabot for .github/actions/install-dependencies by <a href="https://github.com/nschonni"><code>@nschonni</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/532">actions/github-script#532</a></li> <li>chore: Remove .vscode settings by <a href="https://github.com/nschonni"><code>@nschonni</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/533">actions/github-script#533</a></li> <li>ci: Use github/setup-licensed by <a href="https://github.com/nschonni"><code>@nschonni</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/473">actions/github-script#473</a></li> <li>make octokit instance available as octokit on top of github, to make it easier to seamlessly copy examples from GitHub rest api or octokit documentations by <a href="https://github.com/iamstarkov"><code>@iamstarkov</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/508">actions/github-script#508</a></li> <li>Remove <code>octokit</code> README updates for v7 by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/557">actions/github-script#557</a></li> <li>docs: add "exec" usage examples by <a href="https://github.com/neilime"><code>@neilime</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/546">actions/github-script#546</a></li> <li>Bump ruby/setup-ruby from 1.213.0 to 1.222.0 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/github-script/pull/563">actions/github-script#563</a></li> <li>Bump ruby/setup-ruby from 1.222.0 to 1.229.0 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/actions/github-script/pull/575">actions/github-script#575</a></li> <li>Clearly document passing inputs to the <code>script</code> by <a href="https://github.com/joshmgross"><code>@joshmgross</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/603">actions/github-script#603</a></li> <li>Update README.md by <a href="https://github.com/nebuk89"><code>@nebuk89</code></a> in <a href="https://redirect.github.com/actions/github-script/pull/610">actions/github-script#610</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/benelan"><code>@benelan</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/482">actions/github-script#482</a></li> <li><a href="https://github.com/Jcambass"><code>@Jcambass</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/485">actions/github-script#485</a></li> <li><a href="https://github.com/timotk"><code>@timotk</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/478">actions/github-script#478</a></li> <li><a href="https://github.com/iamstarkov"><code>@iamstarkov</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/508">actions/github-script#508</a></li> <li><a href="https://github.com/neilime"><code>@neilime</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/546">actions/github-script#546</a></li> <li><a href="https://github.com/nebuk89"><code>@nebuk89</code></a> made their first contribution in <a href="https://redirect.github.com/actions/github-script/pull/610">actions/github-script#610</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/github-script/compare/v7...v7.1.0">https://github.com/actions/github-script/compare/v7...v7.1.0</a></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="ed597411d8"><code>ed59741</code></a> Merge pull request <a href="https://redirect.github.com/actions/github-script/issues/653">#653</a> from actions/sneha-krip/readme-for-v8</li> <li><a href="2dc352e4ba"><code>2dc352e</code></a> Bold minimum Actions Runner version in README</li> <li><a href="01e118c8d0"><code>01e118c</code></a> Update README for Node 24 runtime requirements</li> <li><a href="8b222ac82e"><code>8b222ac</code></a> Apply suggestion from <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a></li> <li><a href="adc0eeac99"><code>adc0eea</code></a> README for updating actions/github-script from v7 to v8</li> <li><a href="20fe497b3f"><code>20fe497</code></a> Merge pull request <a href="https://redirect.github.com/actions/github-script/issues/637">#637</a> from actions/node24</li> <li><a href="e7b7f222b1"><code>e7b7f22</code></a> update licenses</li> <li><a href="2c81ba05f3"><code>2c81ba0</code></a> Update Node.js version support to 24.x</li> <li>See full diff in <a href="https://github.com/actions/github-script/compare/v7...v8">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
141 lines
5.1 KiB
YAML
141 lines
5.1 KiB
YAML
name: Issue Deduplicator
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- opened
|
|
- labeled
|
|
|
|
jobs:
|
|
gather-duplicates:
|
|
name: Identify potential duplicates
|
|
if: ${{ github.event.action == 'opened' || (github.event.action == 'labeled' && github.event.label.name == 'codex-deduplicate') }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
codex_output: ${{ steps.codex.outputs.final-message }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Prepare Codex inputs
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -eo pipefail
|
|
|
|
CURRENT_ISSUE_FILE=codex-current-issue.json
|
|
EXISTING_ISSUES_FILE=codex-existing-issues.json
|
|
|
|
gh issue list --repo "${{ github.repository }}" \
|
|
--json number,title,body,createdAt \
|
|
--limit 1000 \
|
|
--state all \
|
|
--search "sort:created-desc" \
|
|
| jq '.' \
|
|
> "$EXISTING_ISSUES_FILE"
|
|
|
|
gh issue view "${{ github.event.issue.number }}" \
|
|
--repo "${{ github.repository }}" \
|
|
--json number,title,body \
|
|
| jq '.' \
|
|
> "$CURRENT_ISSUE_FILE"
|
|
|
|
- id: codex
|
|
uses: openai/codex-action@main
|
|
with:
|
|
openai-api-key: ${{ secrets.CODEX_OPENAI_API_KEY }}
|
|
allow-users: "*"
|
|
model: gpt-5
|
|
prompt: |
|
|
You are an assistant that triages new GitHub issues by identifying potential duplicates.
|
|
|
|
You will receive the following JSON files located in the current working directory:
|
|
- `codex-current-issue.json`: JSON object describing the newly created issue (fields: number, title, body).
|
|
- `codex-existing-issues.json`: JSON array of recent issues (each element includes number, title, body, createdAt).
|
|
|
|
Instructions:
|
|
- Compare the current issue against the existing issues to find up to five that appear to describe the same underlying problem or request.
|
|
- Focus on the underlying intent and context of each issue—such as reported symptoms, feature requests, reproduction steps, or error messages—rather than relying solely on string similarity or synthetic metrics.
|
|
- After your analysis, validate your results in 1-2 lines explaining your decision to return the selected matches.
|
|
- When unsure, prefer returning fewer matches.
|
|
- Include at most five numbers.
|
|
|
|
output-schema: |
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"issues": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"reason": { "type": "string" }
|
|
},
|
|
"required": ["issues", "reason"],
|
|
"additionalProperties": false
|
|
}
|
|
|
|
comment-on-issue:
|
|
name: Comment with potential duplicates
|
|
needs: gather-duplicates
|
|
if: ${{ needs.gather-duplicates.result != 'skipped' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- name: Comment on issue
|
|
uses: actions/github-script@v8
|
|
env:
|
|
CODEX_OUTPUT: ${{ needs.gather-duplicates.outputs.codex_output }}
|
|
with:
|
|
github-token: ${{ github.token }}
|
|
script: |
|
|
const raw = process.env.CODEX_OUTPUT ?? '';
|
|
let parsed;
|
|
try {
|
|
parsed = JSON.parse(raw);
|
|
} catch (error) {
|
|
core.info(`Codex output was not valid JSON. Raw output: ${raw}`);
|
|
core.info(`Parse error: ${error.message}`);
|
|
return;
|
|
}
|
|
|
|
const issues = Array.isArray(parsed?.issues) ? parsed.issues : [];
|
|
const currentIssueNumber = String(context.payload.issue.number);
|
|
|
|
console.log(`Current issue number: ${currentIssueNumber}`);
|
|
console.log(issues);
|
|
|
|
const filteredIssues = issues.filter((value) => String(value) !== currentIssueNumber);
|
|
|
|
if (filteredIssues.length === 0) {
|
|
core.info('Codex reported no potential duplicates.');
|
|
return;
|
|
}
|
|
|
|
const lines = [
|
|
'Potential duplicates detected. Please review them and close your issue if it is a duplicate.',
|
|
'',
|
|
...filteredIssues.map((value) => `- #${String(value)}`),
|
|
'',
|
|
'*Powered by [Codex Action](https://github.com/openai/codex-action)*'];
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.issue.number,
|
|
body: lines.join("\n"),
|
|
});
|
|
|
|
- name: Remove codex-deduplicate label
|
|
if: ${{ always() && github.event.action == 'labeled' && github.event.label.name == 'codex-deduplicate' }}
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
run: |
|
|
gh issue edit "${{ github.event.issue.number }}" --remove-label codex-deduplicate || true
|
|
echo "Attempted to remove label: codex-deduplicate"
|