-
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.
Merge branch 'classic' into verify-workflows
- Loading branch information
Showing
4 changed files
with
134 additions
and
6 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
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
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,46 @@ | ||
algorithm: | ||
- 'Algorithm/*' | ||
|
||
asm: | ||
- '**/*.asm' | ||
|
||
c: | ||
- C/* | ||
- '**/*.c' | ||
|
||
c++: | ||
- C++/* | ||
- '**/*.cpp' | ||
- '**/*.c++' | ||
- '**/*.cxx' | ||
- '**/*.ixx' | ||
|
||
ci/cd: | ||
- '*.yml' | ||
- .github/workflows/*.yml | ||
|
||
documentation: | ||
- '**/*.md' | ||
- .github/* | ||
|
||
docs: | ||
- '**/*.md' | ||
|
||
shell: | ||
- '**/*.sh' | ||
- Bash/* | ||
|
||
pr_template: | ||
- .github/PULL_REQUEST_TEMPLATE.md | ||
- .github/pr-bot-template.md | ||
|
||
unknown: | ||
- '**/*.py' | ||
- '**/*.toml' | ||
- '**/*.php' | ||
- '**/*.js' | ||
- '**/*.ts' | ||
- '**/*.rs' | ||
- '.gitignore' | ||
- '.gitattributes' | ||
- 'LICENSE' |
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,78 @@ | ||
name: Automated Label Issues and PRs | ||
|
||
on: | ||
issues: | ||
types: [opened, edited] | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
issues: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Label PRs | ||
uses: actions/labeler@v4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Label Issues | ||
if: github.event_name == 'issues' | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const issue = context.payload.issue; | ||
const labels = []; | ||
const title = issue.title.toLowerCase(); | ||
const body = issue.body ? issue.body.toLowerCase() : ''; | ||
// Match keywords to apply labels based on your labeler.yml configuration | ||
if (title.includes('algorithm') || body.includes('algorithm')) { | ||
labels.push('algorithm'); | ||
} | ||
if (title.includes('.asm') || body.includes('.asm')) { | ||
labels.push('asm'); | ||
} | ||
if (title.includes('.c') || body.includes('.c')) { | ||
labels.push('c'); | ||
} | ||
if (title.includes('.cpp') || title.includes('.c++') || title.includes('.cxx') || title.includes('.ixx') || | ||
body.includes('.cpp') || body.includes('.c++') || body.includes('.cxx') || body.includes('.ixx')) { | ||
labels.push('c++'); | ||
} | ||
if (title.includes('.yml') || body.includes('.yml')) { | ||
labels.push('ci/cd'); | ||
} | ||
if (title.includes('.md') || body.includes('.md')) { | ||
labels.push('documentation'); | ||
labels.push('docs'); | ||
} | ||
if (title.includes('.sh') || body.includes('.sh')) { | ||
labels.push('shell'); | ||
} | ||
if (title.includes('.py') || body.includes('.py') || | ||
title.includes('.toml') || body.includes('.toml') || | ||
title.includes('.php') || body.includes('.php') || | ||
title.includes('.js') || body.includes('.js') || | ||
title.includes('.ts') || body.includes('.ts') || | ||
title.includes('.rs') || body.includes('.rs')) { | ||
labels.push('unknown'); | ||
} | ||
// Apply the labels to the issue | ||
if (labels.length > 0) { | ||
github.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue.number, | ||
labels: labels | ||
}); | ||
} | ||
- name: Finish Off & Cleanup | ||
run: | | ||
echo "Sucessfully Labeled All of the Open Issues and Pull Requests." |