Update dependency @vercel/ncc to v0.38.0 #138
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: update-dist | |
on: | |
issue_comment: | |
types: [created] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
update-dist: | |
name: Update dist | |
if: >- | |
( | |
github.event_name == 'pull_request' && | |
startsWith(github.event.pull_request.head.ref, 'renovate/') | |
) || ( | |
github.event.issue.pull_request && | |
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER') && | |
contains(github.event.comment.body, '/update-dist') | |
) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v6 | |
id: get-ref | |
with: | |
script: | | |
if (context?.pull_request?.head?.ref) { | |
return {ref: context.pull_request.head.ref} | |
} | |
const req = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
} | |
core.info(`Getting PR ${req.pull_number}`) | |
try { | |
const result = await github.rest.pulls.get(req) | |
return {ref: result.data.head.ref} | |
} catch (err) { | |
core.setFailed(`Request failed with error ${err}`) | |
} | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ fromJSON(steps.get-ref.outputs.result).ref }} | |
- uses: actions/setup-node@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Install | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Update | |
run: | | |
if git diff --exit-code; then | |
echo "Up-to-date" | |
exit 0 | |
fi | |
git config --global user.name "sqbot" | |
git config --global user.email "[email protected]" | |
git add dist | |
git commit -m "Update dist" | |
git push origin ${{ fromJSON(steps.get-ref.outputs.result).ref }} |