Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): 🔖 add labels to PRs and use reusable workflows #2829

Closed
wants to merge 4 commits into from
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
32 changes: 32 additions & 0 deletions .github/workflows/add-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🔖 Add status labels

on:
workflow_run:
workflows:
- 🛠️ Build + Test
- 🎨 Check SVG icon colors
- ✅ Check PR Title
types: [completed]

permissions:
contents: read
pull-requests: write

jobs:
add-labels:
runs-on: ubuntu-latest

if: github.event.workflow_run.event == 'pull_request'

steps:
- name: 🏷️ Manage label based on workflow result
uses: material-extensions/add-labels@60e0e247ae419e306ff73fff891bbf9bcf7d85c4 # v1.0.5
with:
labels: |
${{ github.event.workflow_run.name == '🛠️ Build + Test' && '❌ build failed' ||
github.event.workflow_run.name == '🎨 Check SVG icon colors' && '🎨 wrong colors' ||
github.event.workflow_run.name == '✅ Check PR Title' && '📝 invalid title' }}

action: ${{ github.event.workflow_run.conclusion == 'failure' && 'add' || 'remove' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Fixed Show fixed Hide fixed
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
run: bun install --frozen-lockfile

- name: 🚀 Test + Build
id: build
run: |
bun test
bun run vscode:prepublish
1 change: 0 additions & 1 deletion .github/workflows/color-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
git fetch origin $TARGET_BRANCH

- name: 🎨 Check colors
id: color-check
run: |
svgFiles=$(git diff origin/$TARGET_BRANCH --diff-filter=ACMRTUX --name-only | grep '.svg$')
npx svg-color-linter --config material-colors.yml ${svgFiles}
22 changes: 6 additions & 16 deletions .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@ on:
- closed

permissions:
contents: read
pull-requests: write

jobs:
thank-you:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true

steps:
- name: 🙏 Post Thank You Comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
## Merge Successful
uses: material-extensions/workflows/.github/workflows/pr-closed.yml@main
with:
comment: |
## Merge Successful

Thanks for your contribution! 🎉
Thanks for your contribution! 🎉

The changes will be part of the upcoming update on the Marketplace.`
})
The changes will be part of the upcoming update on the Marketplace.
28 changes: 3 additions & 25 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,10 @@ on:
pull_request:
types: [opened, edited]

permissions:
pull-requests: write

jobs:
lint-pr-title:
name: Check PR Title

runs-on: ubuntu-latest

if: ${{ github.event.action == 'opened' || github.event.changes.title != null }}

steps:
- name: 📥 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# Only fetch the config file from the repository
sparse-checkout-cone-mode: false
sparse-checkout: |
commitlint.config.js

- name: 📦 Install dependencies
run: npm install --global @commitlint/config-conventional commitlint

- name: 🔍 Check PR title with commitlint
id: title-check
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HELP_URL: https://github.com/material-extensions/vscode-material-icon-theme/blob/main/CONTRIBUTING.md#conventional-pull-request-titles
run: echo "$PR_TITLE" | npx commitlint --help-url $HELP_URL
uses: material-extensions/workflows/.github/workflows/pr-title.yml@main
with:
commitlint-help-url: https://github.com/material-extensions/vscode-material-icon-theme/blob/main/CONTRIBUTING.md#conventional-pull-request-titles
Loading