mirror of
https://github.com/Azure/setup-kubectl.git
synced 2025-12-12 21:21:19 +00:00
Push it to the forked repo branch.
Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
This commit is contained in:
parent
d2d46d801e
commit
c4de3cbc83
4 changed files with 67 additions and 3 deletions
64
.github/workflows/format-from-comment.yml
vendored
Normal file
64
.github/workflows/format-from-comment.yml
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
name: Format via PR Comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
format-on-comment:
|
||||||
|
if: >
|
||||||
|
github.event.issue.pull_request &&
|
||||||
|
startsWith(github.event.comment.body, '/format')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Get PR Info
|
||||||
|
id: pr
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const pr = await github.rest.pulls.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.payload.issue.number
|
||||||
|
});
|
||||||
|
|
||||||
|
core.setOutput("branch", pr.data.head.ref);
|
||||||
|
core.setOutput("repo", pr.data.head.repo.full_name);
|
||||||
|
core.setOutput("default_branch", pr.data.base.ref);
|
||||||
|
|
||||||
|
- name: Checkout PR branch
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
repository: ${{ steps.pr.outputs.repo }}
|
||||||
|
ref: ${{ steps.pr.outputs.branch }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run Prettier format
|
||||||
|
run: npm run format
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git config user.name "${{ github.actor }}"
|
||||||
|
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||||
|
|
||||||
|
git add .
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "✅ No formatting changes."
|
||||||
|
else
|
||||||
|
git commit -s -m "style: auto-format via /format comment"
|
||||||
|
git push origin HEAD:${{ steps.pr.outputs.branch }}
|
||||||
|
echo "✅ Formatting committed to PR branch."
|
||||||
|
fi
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": true,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"tabWidth": 3,
|
"tabWidth": 3,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -18,7 +18,7 @@
|
||||||
"@types/node": "^24.0.2",
|
"@types/node": "^24.0.2",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^30.0.0",
|
"jest": "^30.0.0",
|
||||||
"prettier": "3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"ts-jest": "^29.4.0",
|
"ts-jest": "^29.4.0",
|
||||||
"typescript": "5.8.3"
|
"typescript": "5.8.3"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
"@types/node": "^24.0.2",
|
"@types/node": "^24.0.2",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^30.0.0",
|
"jest": "^30.0.0",
|
||||||
"prettier": "3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"ts-jest": "^29.4.0",
|
"ts-jest": "^29.4.0",
|
||||||
"typescript": "5.8.3"
|
"typescript": "5.8.3"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue