-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add new blog post issue workflow
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: New Issue (Create Blog Post) | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
env: | ||
ISSUE_TITLE: 'New Blog Post' | ||
|
||
jobs: | ||
open-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ✅ Check Issue | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
if (!github.context.payload.issue.title.startsWith(process.env.ISSUE_TITLE)) { | ||
console.log(`Issue title does not start with "${process.env.ISSUE_TITLE}", skipping`); | ||
process.exit(78); | ||
} | ||
- name: ⬇️ Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: ⎔ Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
|
||
- name: 📦 Install script dependencies | ||
working-directory: scripts | ||
run: npm install | ||
|
||
- name: 📝 Create Blog Post | ||
working-directory: scripts | ||
run: node new-blog.js title ${{ github.event.issue.user.name }} | ||
|
||
- name: 📌 Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: 'feat: create new blog post' | ||
title: 'feat: create new blog post' | ||
body: 'This PR was automatically created by the "New Issue" workflow.' | ||
branch: feat/new-blog-post-${{ github.event.issue.number }} | ||
draft: true |