Skip to content

✍️ DWMRC Blog Post #8

✍️ DWMRC Blog Post

✍️ DWMRC Blog Post #8

name: New Issue (Create Blog Post)
on:
issues:
types: [opened]
jobs:
open-pr:
runs-on: ubuntu-latest
steps:
- name: 🎬 Update status
id: update_status
uses: actions/github-script@v7
with:
script: |
const response = await github.rest.reactions.createForIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
content: 'eyes'
});
return response.data.id;
- name: 🔬 Check actor
uses: tspascoal/get-user-teams-membership@v3
id: checkUserMember
with:
username: ${{ github.actor }}
team: committers
GITHUB_TOKEN: ${{ secrets.ORG_READ_PAT }}
- name: 🛑 Stop if not member
if: ${{ steps.checkUserMember.outputs.isTeamMember == false }}
run: |
echo "You cannot run this job."
exit 86
- name: ⬇️ Checkout Repository
uses: actions/checkout@v4
with:
show-progress: false
- 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.mjs ${{ github.event.issue.number }}
- 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 "Issue opened (new blog)" workflow.
closes #${{ github.event.issue.number}}
branch: feat/new-blog-post-${{ github.event.issue.number }}
draft: true
- name: 🗑️ Remove reaction
uses: actions/github-script@v7
with:
script: |
github.rest.reactions.deleteForIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
reaction_id: ${{ steps.update_status.outputs.result }}
})
- name: ✅ Set complete reaction
uses: actions/github-script@v7
if: ${{ steps.cpr.outputs.pull-request-number }}
with:
script: |
github.rest.reactions.createForIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
content: 'rocket'
});