Translation review required after updates to temurin/commercial-support/index.adoc #120
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: Blog Post Helper | |
on: | |
issues: | |
types: [opened, labeled] | |
jobs: | |
comment: | |
if: contains(github.event.issue.labels.*.name, 'draft-blog-post') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add comment | |
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Thanks for starting a draft blog post! 🎉 | |
You can use this issue to collaborate with others on your post. When you're ready to publish, remove the `draft-blog-post` label and add the `blog-post-ready` label. | |
stage: | |
if: contains(github.event.issue.labels.*.name, 'blog-post-ready') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract issue body and title | |
id: extract | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const body = context.payload.issue.body; | |
const title = context.payload.issue.title; | |
return { body, title }; | |
console.log(`Issue Title: ${title}`); | |
console.log(`Issue Body: ${body}`); | |
core.setOutput('body', body); | |
core.setOutput('title', title); | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- name: Add markdown file to content/blog/${slug}/index.md | |
run: | | |
# generate slug from title | |
slug=$(echo "${{ steps.extract.outputs.title }}" | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z) | |
# create markdown file | |
mkdir content/blog/${slug} | |
echo "---" > content/blog/${slug}/index.md | |
echo "title: ${{ steps.extract.outputs.title }}" >> content/blog/${slug}/index.md | |
echo "date: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> content/blog/${slug}/index.md | |
echo "author: ${{ github.actor }}" >> content/blog/${slug}/index.md] | |
echo "description: set description here" >> content/blog/${slug}/index.md | |
echo "tags: []" >> content/blog/${slug}/index.md | |
echo "---" >> content/blog/${slug}/index.md | |
echo "" >> content/blog/${slug}/index.md | |
echo "${{ steps.extract.outputs.body }}" >> content/blog/${slug}/index.md | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Add blog post: ${{ steps.extract.outputs.title }}" | |
git push | |
- name: Create pull request | |
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Add blog post: ${{ steps.extract.outputs.title }}" | |
title: "Add blog post: ${{ steps.extract.outputs.title }}" | |
body: | | |
This pull request was automatically generated by the Blog Post Helper action. | |
closes: https://github.com/adoptium/adoptium.net/issues/${{ github.event.issue.number }} | |
- name: Add comment | |
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Your blog post has been converted to a pull request. 🎉 | |
See the pull request here: ${{ steps.create-pull-request.outputs.pull-request-url }} |