Skip to content

Commit

Permalink
Merge branch 'classic' into verify-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
offensive-vk authored Aug 30, 2024
2 parents bace72c + 0646cdc commit d4fef66
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/pr-bot-template.md → .github/PR_BOT_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ Please ensure all the boxes below are checked before submitting your pull reques
***
Thanks for considering to submit a pull request! We appreciate your contribution.

### Choose the language of this PR. (One or more)
### Choose the type or language of this Pull Request. (One or more)

1. [ ] Documentation Fixes (Markdown)
2. [ ] Bash / Shell Scripting
2. [ ] Bash Scripts / Shell Scripting
3. [ ] C Programming (Old, Legacy, System Level)
4. [ ] C++ Programming (Modern, High Level, Legacy, System Level)
5. [ ] Dotfiles or Repository ROOT Fixes.
5. [ ] Dotfiles or Repository Fixes.
6. [ ] Assembly x86 (Oldest, Hard, No Changes)
7. [x] Unclassified or Unknown Changes. (Automated)

### Yayy ! This Pull Request Was Automated by a [github-actions](https://github.com/features/actions) Robot.

Expand Down
8 changes: 5 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Please Tick / Choose Options Accordingly - Classics
## Please Tick / Choose Options Accordingly - Classics | C/C++

*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.*

Expand All @@ -18,10 +18,12 @@ Thanks for considering to submit a pull request! We appreciate your contribution
### Choose the language of this PR. (One or more)

1. [ ] Documentation Fixes (Markdown)
2. [ ] Bash / Shell Scripting
2. [ ] Bash Scripts / Shell Scripting
3. [ ] C Programming (Old, Legacy, System Level)
4. [ ] C++ Programming (Modern, High Level, Legacy, System Level)
5. [ ] Dotfiles or Repository ROOT Fixes.
5. [ ] Dotfiles or Repository Fixes.
6. [ ] Assembly x86 (Oldest, Hard, No Changes)
7. [ ] Unclassified or Unknown Changes. (Automated)

**Code formatting**

Expand Down
46 changes: 46 additions & 0 deletions .github/labeler.yml
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'
78 changes: 78 additions & 0 deletions .github/workflows/label.yml
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."

0 comments on commit d4fef66

Please sign in to comment.