Skip to content

update-vote-results #436

update-vote-results

update-vote-results #436

Workflow file for this run

name: update-vote-results
on:
workflow_dispatch:
inputs:
comment_id:
type: string
required: true
env:
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
DENO_DIR: .deno-cache
REPO: commonhaus/commonhaus.github.io
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Setup Deno environment
uses: denoland/setup-deno@v2
with:
deno-version: v1.x
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Deno dependencies
uses: actions/cache@v4
with:
path: ${{ env.DENO_DIR }}
key: ${{ hashFiles('deno.lock') }}
- name: Git Config
run: |
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
- name: Git Vote Update
id: votes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT: ${{ github.event.inputs.comment_id }}
run: |
echo "Updating vote results..."
deno task votes "${INPUT}"
git add -A -- ./site/_generated/votes
if git diff --quiet HEAD; then
echo "-- No changes -- "
else
git commit -am "🗳️ Auto-update GH Votes"
git pull --rebase
git push
echo "updated=true" >> $GITHUB_OUTPUT
fi
- name: Push GH Pages
if: ${{ steps.votes.outputs.updated == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run -R commonhaus/commonhaus.github.io gh-pages.yml