-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix dep. check fix dep. check fix dep. check fix dep. check fix dep. check fix dep. check fix dep. check fix dep. check fix dep. check fix dependency check added pr dependency-check
- Loading branch information
1 parent
6247050
commit b8b7af5
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Issues Dependency Check | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
pull_request_review: | ||
types: [submitted, edited, dismissed] | ||
jobs: | ||
check-dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check for unresolved dependencies | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
// Updated regex to match multiple issue numbers | ||
const issueRegex = /depends on #(\\d+(?:\\s+#\\d+)*)/ig; | ||
async function run() { | ||
let match; | ||
let blockingIssues = []; | ||
// Find issues mentioned in the description | ||
while ((match = issueRegex.exec(context.payload.body)) !== null) { | ||
const issues = match[1].split(/\\s+#/); | ||
for (const issueNumber of issues) { | ||
const { data: issue } = await github.rest.issues.get({ | ||
owner: adamamer20, | ||
repo: mesa_frames, | ||
issue_number: parseInt(issueNumber), | ||
}); | ||
if (issue.state === 'open') { | ||
blockingIssues.push(issueNumber); | ||
} | ||
} | ||
} | ||
if (blockingIssues.length > 0) { | ||
core.setFailed(`Cannot merge PR because these issues are not resolved: #${blockingIssues.join(', #')}`); | ||
} | ||
} | ||
run().catch(error => core.setFailed(error.message)); |