-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from pankona/fmt-yaml
Format YAML with yamlfmt and dprint
- Loading branch information
Showing
7 changed files
with
163 additions
and
137 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 |
---|---|---|
|
@@ -15,48 +15,48 @@ jobs: | |
env: | ||
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Needed to specify token for checkout phase, only in push phase is too late | ||
# https://github.com/orgs/community/discussions/27072#discussioncomment-3254515 | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- name: debug logging for git remotes | ||
run: git remote -v | ||
- name: Normalize issue title | ||
id: normalizer | ||
env: | ||
ISSUE_TITLE: ${{ github.event.issue.title }} | ||
run: | | ||
title="$ISSUE_TITLE" | ||
title="${title//\[*\]/}" | ||
title=`echo $title | xargs` | ||
echo "title=${title// /-}" | tee -a "$GITHUB_OUTPUT" | ||
- name: setup go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'tool/go.mod' | ||
cache-dependency-path: 'tool/go.sum' | ||
- name: install articlegen | ||
run: | | ||
cd ./tool/articlegen | ||
go install . | ||
- name: install makepr | ||
run: | | ||
cd ./tool/makepr | ||
go install . | ||
- name: commit | ||
run: | | ||
GITHUB_TOKEN=${TOKEN} articlegen --issue-num=${{ github.event.issue.number }} > 'content/posts/${{ steps.normalizer.outputs.title }}.md' | ||
git config user.email "[email protected]" | ||
git config user.name "pankona" | ||
git switch '${{ steps.normalizer.outputs.title }}' || git switch -c '${{ steps.normalizer.outputs.title }}' | ||
git add 'content/posts/${{ steps.normalizer.outputs.title }}.md' | ||
git commit -m "add post ${{ steps.normalizer.outputs.title }}" | ||
- name: push | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# "--force-with-lease" will not fit for upserting | ||
run: | | ||
pr_number="$(gh pr list --author "@me" --head '${{ steps.normalizer.outputs.title }}' --state open --json number --jq 'map(.number)[0]')" | ||
git push --set-upstream origin "${{ steps.normalizer.outputs.title }}" --force | ||
GITHUB_TOKEN=${TOKEN} makepr --base="main" --head='${{ steps.normalizer.outputs.title }}' --pr_number="${pr_number:=0}" --body="Resolves: ${{ github.event.issue.html_url }}" | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Needed to specify token for checkout phase, only in push phase is too late | ||
# https://github.com/orgs/community/discussions/27072#discussioncomment-3254515 | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- name: debug logging for git remotes | ||
run: git remote -v | ||
- name: Normalize issue title | ||
id: normalizer | ||
env: | ||
ISSUE_TITLE: ${{ github.event.issue.title }} | ||
run: | | ||
title="$ISSUE_TITLE" | ||
title="${title//\[*\]/}" | ||
title=`echo $title | xargs` | ||
echo "title=${title// /-}" | tee -a "$GITHUB_OUTPUT" | ||
- name: setup go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'tool/go.mod' | ||
cache-dependency-path: 'tool/go.sum' | ||
- name: install articlegen | ||
run: | | ||
cd ./tool/articlegen | ||
go install . | ||
- name: install makepr | ||
run: | | ||
cd ./tool/makepr | ||
go install . | ||
- name: commit | ||
run: | | ||
GITHUB_TOKEN=${TOKEN} articlegen --issue-num=${{ github.event.issue.number }} > 'content/posts/${{ steps.normalizer.outputs.title }}.md' | ||
git config user.email "[email protected]" | ||
git config user.name "pankona" | ||
git switch '${{ steps.normalizer.outputs.title }}' || git switch -c '${{ steps.normalizer.outputs.title }}' | ||
git add 'content/posts/${{ steps.normalizer.outputs.title }}.md' | ||
git commit -m "add post ${{ steps.normalizer.outputs.title }}" | ||
- name: push | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# "--force-with-lease" will not fit for upserting | ||
run: | | ||
pr_number="$(gh pr list --author "@me" --head '${{ steps.normalizer.outputs.title }}' --state open --json number --jq 'map(.number)[0]')" | ||
git push --set-upstream origin "${{ steps.normalizer.outputs.title }}" --force | ||
GITHUB_TOKEN=${TOKEN} makepr --base="main" --head='${{ steps.normalizer.outputs.title }}' --pr_number="${pr_number:=0}" --body="Resolves: ${{ github.event.issue.html_url }}" |
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
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,31 @@ | ||
name: Lint | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
typo: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: crate-ci/[email protected] | ||
with: | ||
# https://github.com/crate-ci/typos/issues/779#issuecomment-1635761199 | ||
files: | | ||
. | ||
.github | ||
.vscode | ||
format: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup go to install yamlfmt | ||
uses: actions/setup-go@v5 | ||
- name: Install yamlfmt | ||
run: | | ||
go install github.com/google/yamlfmt/cmd/[email protected] | ||
- uses: dprint/[email protected] | ||
with: | ||
dprint-version: 0.45.0 |
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
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
{ | ||
"excludes": [], | ||
"exec": { | ||
"commands": [{ | ||
"command": "yamlfmt -in -formatter retain_line_breaks=true", | ||
"exts": ["yaml", "yml"] | ||
}] | ||
}, | ||
"plugins": [ | ||
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
peco | ||
typos | ||
dprint | ||
yamlfmt | ||
imagemagick | ||
actionlint | ||
nil | ||
|