Add SVGO warning comment to pull requests #6
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
name: Add SVGO Warning to PRs | |
on: | |
pull_request: | |
types: [opened, edited, reopened] | |
jobs: | |
add-warning: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Add Warning Comment | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { context, github } = require('@actions/github'); | |
const issue_number = context.payload.pull_request.number; | |
const repo = context.repo.repo; | |
const owner = context.repo.owner; | |
const comment = { | |
owner, | |
repo, | |
issue_number, | |
body: '⚠️ Please ensure all SVG files are optimized using SVGO, by running `npm run svgo`, before merging this pull request.' | |
}; | |
await github.issues.createComment(comment); |