Skip to content

Commit

Permalink
Merge pull request #310 from MH4GF/update-dist
Browse files Browse the repository at this point in the history
fix: update dist when pull_request event
  • Loading branch information
MH4GF committed Feb 17, 2024
2 parents 87cacbf + f1feda7 commit 752f3ad
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 264 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/check-dist.yml

This file was deleted.

30 changes: 9 additions & 21 deletions .github/workflows/update-dist.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
name: Update Dist on PR Comment
name: Update Dist

on:
issue_comment:
types: [created]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
update-dist:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/update-dist')
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Set branch ref
uses: actions/github-script@v7
id: set-target-branch
with:
result-encoding: string
script: |
const pull_request = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
return pull_request.data.head.ref
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.set-target-branch.outputs.result }}
token: ${{ secrets.MH4GF_PAT }}
ref: ${{ github.event.pull_request.head.ref }}

- uses: MH4GF/shared-config/.github/composite-actions/setup-pnpm@main
with:
Expand All @@ -43,8 +31,8 @@ jobs:
- name: Commit and Push if there are changes
run: |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --staged --quiet || git commit -m 'update dist'
git push
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .husky/pre-commit

This file was deleted.

11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,16 @@
"author": "",
"main": "lib/main.js",
"scripts": {
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"all": "npm run build && npm run format && npm run lint && npm test",
"build": "tsc",
"coverage": "vitest run --coverage",
"format": "prettier --write .",
"lint": "run-s lint:*",
"lint:eslint": "eslint src",
"lint:prettier": "prettier --check .",
"package": "ncc build src/main.ts --source-map --license licenses.txt",
"prepare": "husky install",
"test": "vitest"
},
"lint-staged": {
"*.ts": [
"pnpm run lint:eslint",
"pnpm run format"
]
},
"prettier": "@mh4gf/configs/prettier",
"dependencies": {
"@actions/core": "^1.10.1",
Expand All @@ -48,9 +41,7 @@
"@vercel/ncc": "^0.38.1",
"dependency-cruiser": "15.4.0",
"eslint": "^8.56.0",
"husky": "^8.0.3",
"js-yaml": "^4.1.0",
"lint-staged": "^15.2.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"typescript": "^5.1.6",
Expand Down
Loading

0 comments on commit 752f3ad

Please sign in to comment.