Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

381: update the linked issue workflow to reuse the compose reusable workflow. #383

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 3 additions & 37 deletions .github/workflows/link_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,6 @@ on:

jobs:
check-linked-issue:
if: github.event.pull_request.user.login != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Verify Linked Issue
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { pull_request } = context.payload;
const bodyText = pull_request.body || '';
const issuePattern = /(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\s+#(\d+)/i;
const match = bodyText.match(issuePattern);

if (!match) {
core.setFailed('No linked issue found in the pull request description.');
return;
}

const issueNumber = parseInt(match[1], 10);
const { owner, repo } = context.repo;

try {
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issueNumber
});
const minLength = 30; // Minimum description length

if (!issue.data.body || issue.data.body.trim().length < minLength) {
core.setFailed(`Linked issue #${issueNumber} does not have a sufficient description (at least ${minLength} characters required).`);
} else {
console.log(`Linked issue #${issueNumber} has a sufficient description.`);
}
} catch (error) {
core.setFailed(`Issue #${issueNumber} not found or inaccessible.`);
}
uses: wildlife-dynamics/compose/.github/workflows/check-linked-issue.yaml@main
with:
pr_body: ${{ github.event.pull_request.body }}
Loading