attempt 2 #2
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
# Based on https://github.com/SheepTester/longer-tweets/blob/master/.github/workflows/comment.yml | |
name: Add comment | |
on: | |
issues: | |
types: opened | |
jobs: | |
comment-and-build: | |
name: Write comment to comments.yml, then build | |
if: ${{ contains(github.event.issue.labels.*.name, 'comment') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm install | |
- name: Write to data/comments.yml | |
run: npx tsx dev/add-comment.ts '${{ toJson(github.event) }}' | |
- name: Build | |
run: npx tsx dev/build.ts | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: public/ | |
- name: Push changes | |
run: | | |
git config --local user.name 'Github Actions: ${{ github.action }} (for @${{ github.event.sender.login }})' | |
git config --local user.email '${{ github.event.sender.login }}@users.noreply.github.com' | |
git add data/comments.yml | |
git commit -m "Add comment from @${{ github.event.sender.login }} | |
Resolves #${{ github.event.issue.number }}" | |
git push | |
permissions: | |
contents: write | |
# Deployment job from https://github.com/ucsd-cse125-sp24/group1/blob/main/.github/workflows/gh-pages.yml | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: comment-and-build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
permissions: | |
pages: write | |
id-token: write |