forked from Anishkagupta04/RAPIDOC-HEALTHCARE-WEBSITE-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the branch and added the code
- Loading branch information
1 parent
ee9b31f
commit 94b7c7d
Showing
2 changed files
with
43 additions
and
32 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 |
---|---|---|
@@ -1,26 +1,38 @@ | ||
name: Auto Label PRs | ||
name: Auto Label and Issue Check | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited] | ||
types: [opened, edited, synchronize] | ||
|
||
jobs: | ||
label_pr: | ||
auto-label-and-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
configuration-path: .github/labeler.yml | ||
|
||
- name: Add GSSOC label | ||
- name: Add GSSoC Label and Check Issue | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['gssoc'] | ||
}) | ||
const { owner, repo } = context.repo; | ||
const pr = context.payload.pull_request; | ||
try { | ||
await github.rest.issues.addLabels({ | ||
issue_number: pr.number, | ||
owner: owner, | ||
repo: repo, | ||
labels: ['gssoc'] | ||
}); | ||
console.log('Added gssoc label'); | ||
} catch (error) { | ||
console.error('Error adding gssoc label:', error); | ||
} | ||
const body = pr.body || ''; | ||
const issueMatch = body.match(/(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\s*:?\s*#(\d+)/i); | ||
if (!issueMatch) { | ||
core.setFailed('No related issue mentioned in the PR description. Please use the PR template and mention the related issue.'); | ||
} else { | ||
console.log('Related issue found:', issueMatch[1]); | ||
} |
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