Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/new_icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Tick the checkboxes to ensure you've done everything correctly -->
- [ ] PR does not match another non-stale PR currently opened
- [ ] PR name matches the format *new icon: <i>Icon name</i> (<i>versions separated by comma</i>)*. More details [here](https://github.com/devicons/devicon/wiki/Overview-on-Submitting-Icons)
- [ ] PR's base is the `develop` branch.
- [ ] PR's base is the `master` branch.
- [ ] Your icons are inside a folder as seen [here](https://github.com/devicons/devicon/wiki/Organizing-SVGs)
- [ ] SVG matches the standards laid out [here](https://github.com/devicons/devicon/wiki/SVG-Standards)
- [ ] A new object is added in the `devicon.json` file at the correct alphabetic position as seen [here](https://github.com/devicons/devicon/wiki/Updating-%60devicon.json%60)
Expand Down
24 changes: 0 additions & 24 deletions .github/scripts/in_develop_labeler.py

This file was deleted.

188 changes: 188 additions & 0 deletions .github/workflows/auto_build_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Auto Build and Merge
on:
pull_request_review:
types: [submitted]

jobs:
auto-build-merge:
name: Auto Build and Merge
runs-on: ubuntu-latest
if: github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'master'

steps:
- name: Check if PR modifies icon files
id: check-files
uses: actions/github-script@v7
with:
script: |
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

const hasIconChanges = files.some(file =>
file.filename.startsWith('icons/') || file.filename === 'devicon.json'
);

console.log('Has icon changes:', hasIconChanges);
core.setOutput('has_icon_changes', hasIconChanges);

if (!hasIconChanges) {
console.log('PR does not modify icon files, skipping build');
}

return hasIconChanges;

- name: Check approval count
if: steps.check-files.outputs.has_icon_changes == 'true'
id: check-approvals
uses: actions/github-script@v7
with:
script: |
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

// Get unique approvers (latest review per user)
const reviewsByUser = {};
for (const review of reviews) {
if (!reviewsByUser[review.user.login] ||
new Date(review.submitted_at) > new Date(reviewsByUser[review.user.login].submitted_at)) {
reviewsByUser[review.user.login] = review;
}
}

const approvals = Object.values(reviewsByUser).filter(r => r.state === 'APPROVED');
const approvalCount = approvals.length;

console.log('Approval count:', approvalCount);
core.setOutput('approval_count', approvalCount);
core.setOutput('approvers', JSON.stringify(approvals.map(r => r.user.login)));

if (approvalCount < 1) {
console.log('Less than 1 approval, skipping build');
return false;
}

return true;

- name: Checkout PR branch
if: steps.check-approvals.outputs.approval_count >= 1
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python 3.10
if: steps.check-approvals.outputs.approval_count >= 1
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Setup Node.js
if: steps.check-approvals.outputs.approval_count >= 1
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Install Python dependencies
if: steps.check-approvals.outputs.approval_count >= 1
run: |
python -m pip install --upgrade pip
pip install -r ./.github/scripts/requirements.txt

- name: Install Node dependencies
if: steps.check-approvals.outputs.approval_count >= 1
run: npm install

- name: Run Icomoon build
if: steps.check-approvals.outputs.approval_count >= 1
id: build
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python ./.github/scripts/icomoon_build.py \
./.github/scripts/build_assets/geckodriver-v0.32.2-linux64/geckodriver \
./icomoon.json \
./devicon.json \
./icons \
./ \
$GITHUB_TOKEN \
--headless

- name: Build CSS
if: steps.build.outcome == 'success'
id: build-css
continue-on-error: true
run: npm run build-css

- name: Handle build failure
if: steps.build.outcome == 'failure' || steps.build-css.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const approvers = JSON.parse('${{ steps.check-approvals.outputs.approvers }}');
const prAuthor = context.payload.pull_request.user.login;
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;

const mentions = ['@' + prAuthor, ...approvers.map(a => '@' + a)].join(' ');

const commentBody = `${mentions}

The Icomoon build has failed for this PR. Please review the errors and fix them.

**Workflow run:** ${runUrl}

The build must pass before this PR can be merged.`;

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: commentBody
});

await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['build-failed']
});

core.setFailed('Build failed');

- name: Commit build artifacts
if: steps.build.outcome == 'success' && steps.build-css.outcome == 'success'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
if ! git diff --staged --quiet; then
git commit -m "build: generate font files and CSS

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>"
git push
else
echo "No changes to commit"
fi

- name: Merge PR
if: steps.build.outcome == 'success' && steps.build-css.outcome == 'success'
uses: actions/github-script@v7
with:
script: |
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
merge_method: 'squash'
});

console.log('PR merged successfully');
1 change: 1 addition & 0 deletions .github/workflows/build_icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
Adios,
Build Bot :sunglasses:
with:
base: master
branch: 'bot/build-result'
commit-message: 'Built new icons, icomoon.json and devicon.css'
title: 'bot:build new icons, icomoon.json and devicon.css'
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/check_icon_pr.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
name: Check Icon PR
on: pull_request
on:
pull_request:
paths:
- 'icons/**'
- 'devicon.json'
jobs:
check:
name: Check the `devicon.json` and the SVGs' quality
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.title, 'new icon') || startsWith(github.event.pull_request.title, 'update icon') # only checks icon PR
steps:
- uses: actions/checkout@v4

- name: Check if PR is develop
if: ${{ github.base_ref != 'develop' }}
- name: Check if PR targets master
if: ${{ github.base_ref != 'master' }}
run: |
echo -e "The PR's base branch is \`${{ github.base_ref }}\`, but should be \`develop\`\nPlease change the PR so that it's based on, and merged into \`develop\`" > ./err_messages.txt
echo "wrong_branch=true" >> $GITHUB_ENV
echo "Error: This PR targets '${{ github.base_ref }}' but should target 'master'"
echo "Please change the PR so that it's based on, and merged into 'master'"
exit 1

- uses: actions/setup-python@v5
if: ${{ !env.wrong_branch }}
with:
python-version: 3.8

- name: Install dependencies
if: ${{ !env.wrong_branch }}
run: |
python -m pip install --upgrade pip
pip install -r ./.github/scripts/requirements.txt

- name: Run the check_svg script
if: ${{ !env.wrong_branch }}
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: python ./.github/scripts/check_icon_pr.py "$PR_TITLE" ./icons ./devicon.json
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "Code Scanning - Action"

on:
push:
branches: [master, develop]
branches: [master]
pull_request:
branches: [master, develop]
branches: [master]
schedule:
- cron: 30 1 * * 0 # Runs every Sunday 1:30 am UTC

Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/in_develop_labeler.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/in_develop_labeler_preflight.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/peek_icons.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Peek Icons
on:
pull_request:
types: [labeled]
types: [opened, synchronize, reopened]
paths:
- 'icons/**'
- 'devicon.json'
jobs:
peek:
# four outcomes: successful check and upload,
# unsuccessful check (fail due to user),
# fail due to system, skipped
name: Peek Icons
if: github.event.label.name == 'bot:peek'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
Loading
Loading