Update dependency @actions/core to v1.11.1 #264
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@v7 | |
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@v4 | |
with: | |
ref: ${{ fromJSON(steps.get-ref.outputs.result).ref }} | |
- name: Enable pnpm | |
run: corepack enable pnpm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install | |
run: pnpm install | |
- name: Build | |
run: pnpm 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 }} |