hair donation is a long way to go #222
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: generate_pr_from_issue | |
on: | |
issues: | |
types: [opened, edited, labeled, unlabeled] | |
jobs: | |
build: | |
if: (github.event.sender.login == 'pankona') && contains(github.event.issue.labels.*.name, 'article') | |
runs-on: ubuntu-latest | |
env: | |
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'tool/articlegen/go.mod' | |
cache-dependency-path: 'tool/articlegen/go.sum' | |
- name: install articlegen | |
run: | | |
cd ./tool/articlegen | |
go install . | |
- name: install makepr | |
run: | | |
cd ./tool/makepr | |
go install . | |
- name: commit | |
env: | |
ISSUE_TITLE: ${{ github.event.issue.title }} | |
run: | | |
title="$ISSUE_TITLE" | |
title="${title//\[*\]/}" | |
title=`echo $title | xargs` | |
title="${title// /-}" | |
GITHUB_TOKEN=${TOKEN} articlegen --issue-num=${{ github.event.issue.number }} > content/posts/${title}.md | |
git config --global user.email "[email protected]" | |
git config --global user.name "pankona" | |
git switch -c ${title} | |
git add content/posts/${title}.md | |
git commit -m "add post ${title}" | |
- name: push | |
env: | |
ISSUE_TITLE: ${{ github.event.issue.title }} | |
run: | | |
title="$ISSUE_TITLE" | |
title="${title//\[*\]/}" | |
title=`echo $title | xargs` | |
title="${title// /-}" | |
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all | |
git push https://x-access-token:${TOKEN}@github.com/pankona/pankona.github.com.git ${title} -f | |
GITHUB_TOKEN=${TOKEN} makepr --base="main" --head="${title}" --body="Resolves: ${{ github.event.issue.html_url }}" |