Skip to content

Commit

Permalink
dprint fmt for format YAMLs
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Feb 6, 2024
1 parent 75855b5 commit 2e5a376
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 119 deletions.
90 changes: 45 additions & 45 deletions .github/workflows/generate_pr_from_issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
82 changes: 41 additions & 41 deletions .github/workflows/generate_site_and_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ jobs:
# Keep same version with `make deps`
HUGO_VERSION: 0.122.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v4
# Required go env because hugo module depends on it
- name: Cache hugo resources
uses: actions/cache@v4
with:
path: /home/runner/.cache/hugo_cache
key: ${{ runner.os }}-hugo-v${{ env.HUGO_VERSION }}-hugomod-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-hugo-v${{ env.HUGO_VERSION }}-hugomod-
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo --panicOnWarning \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
if: github.event.sender.login == 'pankona'
uses: actions/upload-pages-artifact@v3
with:
path: ./public
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v4
# Required go env because hugo module depends on it
- name: Cache hugo resources
uses: actions/cache@v4
with:
path: /home/runner/.cache/hugo_cache
key: ${{ runner.os }}-hugo-v${{ env.HUGO_VERSION }}-hugomod-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-hugo-v${{ env.HUGO_VERSION }}-hugomod-
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo --panicOnWarning \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
if: github.event.sender.login == 'pankona'
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
environment:
name: github-pages
Expand Down
66 changes: 33 additions & 33 deletions .github/workflows/notify_long_time_no_see.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: notify_long_time_no_see
on:
workflow_dispatch:
schedule:
- cron: '0 22 * * *'
- cron: '0 22 * * *'
pull_request:
paths:
- 'tool/sincelastcommit/**'
Expand All @@ -13,36 +13,36 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Checkout articles in head ref to collect git info
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
path: tmp/head
- name: setup go
uses: actions/setup-go@v5
with:
go-version-file: 'tool/go.mod'
cache-dependency-path: 'tool/go.sum'
- name: install sincelastcommit
run: go install -C ./tool/sincelastcommit
- name: Logging the collection items are actually head
run: |
cd tmp/head
git log -- content/posts
- name: check since last commit
run: |
cd tmp/head
days="$(sincelastcommit)"
echo "SINCE_LAST_COMMIT=${days}" | tee -a "$GITHUB_ENV"
- name: Slack Notification
if: env.SINCE_LAST_COMMIT >= 7 && github.event_name != 'pull_request'
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: notification
SLACK_MESSAGE: "最後のブログ更新から ${{ env.SINCE_LAST_COMMIT }} 日過ぎています。"
SLACK_USERNAME: pankona
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Checkout codebase
uses: actions/checkout@v4
- name: Checkout articles in head ref to collect git info
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
path: tmp/head
- name: setup go
uses: actions/setup-go@v5
with:
go-version-file: 'tool/go.mod'
cache-dependency-path: 'tool/go.sum'
- name: install sincelastcommit
run: go install -C ./tool/sincelastcommit
- name: Logging the collection items are actually head
run: |
cd tmp/head
git log -- content/posts
- name: check since last commit
run: |
cd tmp/head
days="$(sincelastcommit)"
echo "SINCE_LAST_COMMIT=${days}" | tee -a "$GITHUB_ENV"
- name: Slack Notification
if: env.SINCE_LAST_COMMIT >= 7 && github.event_name != 'pull_request'
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: notification
SLACK_MESSAGE: "最後のブログ更新から ${{ env.SINCE_LAST_COMMIT }} 日過ぎています。"
SLACK_USERNAME: pankona
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 comments on commit 2e5a376

Please sign in to comment.