fix: bunch of manual linking #15
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: Images | |
# responsible for creating the images for the event | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/content/events/**' | |
workflow_call: | |
inputs: | |
date: | |
description: 'Event Date (YYYY-MM-DD)' | |
required: true | |
type: string | |
image: | |
description: 'Image Type (banner, meetup-image)' | |
default: banner, meetup-image | |
type: string | |
workflow_dispatch: | |
inputs: | |
date: | |
description: 'Event Date (YYYY-MM-DD)' | |
required: true | |
type: string | |
image: | |
description: 'Image Type (banner, meetup-image)' | |
default: banner, meetup-image | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: npm install | |
- name: set date on push event | |
if: github.event_name == 'push' | |
run: | | |
DATE=$(./script/eventchanged) | |
echo "DATE=$DATE" >> $GITHUB_ENV | |
- name: set date on workflow_dispatch or workflow_call event | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' | |
run: | | |
DATE="${{ github.event.inputs.date }}" | |
echo "DATE=$DATE" >> $GITHUB_ENV | |
- name: create git message | |
id: MESSAGE | |
env: | |
DATE: ${{ env.DATE }} | |
run: | | |
MESSAGE="Add image(s) ${{ inputs.image }} for ${{ env.DATE }}" | |
echo "$MESSAGE" | |
echo "message=$MESSAGE" >> $GITHUB_OUTPUT | |
- run: echo "${{ steps.MESSAGE.outputs.MESSAGE }}" | |
- name: generate image(s) | |
env: | |
DATE: ${{ env.DATE }} | |
run: | | |
npm run genimage -- --date "${{ env.DATE }}" | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add . | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: ${{ steps.MESSAGE.outputs.MESSAGE }} | |
title: ${{ steps.MESSAGE.outputs.MESSAGE }} | |
body: ${{ steps.MESSAGE.outputs.MESSAGE }} | |
branch: 'image-${{ github.run_id }}' |