Add localStorage subfeature #2496
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: Auto Respond to PR | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
paths: | |
- '**.json' | |
- '**.js' | |
- '**.yml' | |
jobs: | |
auto_respond: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create comment | |
if: github.event.action == 'opened' | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Don't forget to assign an individual reviewer (in addition to those already added, this should create a task for them in Asana). | |
Please mark this as draft unless there's intention to merge this. | |
Click the "Merge When Ready" if you're happy for this to automatically get merged once reviewed. | |
Also don't forget to add schema changes to validate if you're adding/changing a feature. | |
- [Config Reviewer Documentation](https://app.asana.com/0/1200890834746050/1204443212791216/f) | |
- [Config Maintainer Documentation](https://app.asana.com/0/1200890834746050/1200573250322769/f) | |
- [Feature Implementer Documentation](https://app.asana.com/0/1200890834746050/1201498956177210/f) | |
- name: Checkout base branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
path: base | |
- name: Checkout PR branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
path: pr | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
npm install diff | |
- name: Run build script on base branch | |
run: | | |
cd base | |
npm install | |
node index.js | |
cd .. | |
- name: Run build script on PR branch | |
run: | | |
cd pr | |
git config --global user.email "dax@duck.com" | |
git config --global user.name "dax" | |
git rebase -X theirs origin/${{ github.event.pull_request.base.ref }} | |
npm install | |
node index.js | |
cd .. | |
- name: Create diff of file outputs | |
run: node pr/.github/scripts/diff-directories.js base/generated pr/generated > diff_output.txt | |
- name: Find Previous Comment | |
uses: peter-evans/find-comment@v3 | |
id: find_comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'Generated file outputs' | |
direction: last | |
- name: Create Comment Body | |
uses: actions/github-script@v7 | |
id: create_body | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
const prNumber = context.issue.number; | |
const diffOutput = fs.readFileSync('diff_output.txt', 'utf8'); | |
let commentBody = ` | |
### Generated file outputs: | |
*Time updated:* ${new Date().toUTCString()} | |
${diffOutput} | |
` | |
if (commentBody.length > 65536) { | |
commentBody = '❌ Generated diff output is too large to post as a comment, run locally to see the diff and validate' | |
} | |
core.setOutput('comment_body', commentBody); | |
- name: Create, or Update the Comment | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find_comment.outputs.comment-id }} | |
body: ${{ steps.create_body.outputs.comment_body }} | |
edit-mode: replace |