fix(deps): update dependency stylelint to v16.12.0 (stylelint-config) #251
Workflow file for this run
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 Snapshot | |
on: | |
workflow_dispatch: | |
inputs: | |
eslint: | |
description: "Update ESLint Config Snapshot" | |
required: true | |
default: false | |
type: boolean | |
prettier: | |
description: "Update Prettier Config Snapshot" | |
required: true | |
default: false | |
type: boolean | |
stylelint: | |
description: "Update Stylelint Config Snapshot" | |
required: true | |
default: false | |
type: boolean | |
pull_request: | |
types: [labeled] | |
branches: | |
- "main" | |
paths: | |
- "packages/**" | |
- "package.json" | |
- ".github/workflows/update-snapshot.yml" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-target-packages: | |
name: Check Target Packages (Update Snapshot) | |
runs-on: ubuntu-24.04 | |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && !contains(github.event.pull_request.user.name, 'bot') && github.event.label.name == 'update-snapshot') | |
outputs: | |
eslint: ${{ steps.target-packages.outputs.eslint }} | |
prettier: ${{ steps.target-packages.outputs.prettier }} | |
stylelint: ${{ steps.target-packages.outputs.stylelint }} | |
steps: | |
- name: Fail if triggered from invalid PR (Pull Request) | |
if: github.event_name == 'pull_request' | |
run: | | |
if [ "${{ github.event.pull_request.state }}" != 'open' ]; then | |
echo "::error::PR is not open." | |
exit 1 | |
fi | |
if [ "${{ github.event.pull_request.draft }}" == 'true' ]; then | |
echo "::error::Cannot update snapshot for draft PR." | |
exit 1 | |
fi | |
- name: Fail if triggered from invalid Tag (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
if [ ${{ contains(github.ref, 'refs/tags') }} == 'true' ]; then | |
echo "::error::Cannot update snapshot for tag." | |
exit 1 | |
fi | |
- name: Check target packages (PR Comment) | |
if: github.event_name == 'pull_request' | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: pr-target | |
with: | |
filters: | | |
eslint: | |
- 'packages/eslint-config/**' | |
prettier: | |
- 'packages/prettier-config/**' | |
stylelint: | |
- 'packages/stylelint-config/**' | |
- name: Export target packages for output | |
id: target-packages | |
run: | | |
if [ ${{ github.event_name }} == 'pull_request' ]; then | |
echo "eslint=${{ steps.pr-target.outputs.eslint }}" >> $GITHUB_OUTPUT | |
echo "prettier=${{ steps.pr-target.outputs.prettier }}" >> $GITHUB_OUTPUT | |
echo "stylelint=${{ steps.pr-target.outputs.stylelint }}" >> $GITHUB_OUTPUT | |
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]; then | |
echo "eslint=${{ github.event.inputs.eslint }}" >> $GITHUB_OUTPUT | |
echo "prettier=${{ github.event.inputs.prettier }}" >> $GITHUB_OUTPUT | |
echo "stylelint=${{ github.event.inputs.stylelint }}" >> $GITHUB_OUTPUT | |
else | |
echo "::error::Workflow called by unexpected event." | |
exit 1 | |
fi | |
update-snapshot: | |
name: Update Snapshot (Update Snapshot) | |
needs: check-target-packages | |
if: (needs.check-target-packages.outputs.eslint == 'true' || needs.check-target-packages.outputs.prettier == 'true' || needs.check-target-packages.outputs.stylelint == 'true') | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
pull-requests: write | |
timeout-minutes: 10 | |
steps: | |
- name: Get GitHub Access Token from GitHub App | |
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | |
id: app-token | |
with: | |
app-id: ${{ vars.ACTIONS_MIKU_APP_ID }} | |
private-key: ${{ secrets.ACTIONS_MIKU_PRIVATE_KEY }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- name: Configure Git Identity | |
run: | | |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
- name: Checkout Repo (Pull Request) | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Checkout Repo (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.ref }} | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Create Branch (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
git switch -c "bot/update-snapshot-$(TZ=UTC-9 date +'%Y%m%d')-${{ github.run_id }}-${{ github.run_attempt }}" | |
- name: Setup Node.js and pnpm | |
uses: ./.github/common/setup-node-pnpm | |
- name: Update ESLint Config Snapshot | |
if: needs.check-target-packages.outputs.eslint == 'true' | |
run: pnpm run build:eslint && pnpm run test --project eslint-config -u | |
- name: Update Prettier Config Snapshot | |
if: needs.check-target-packages.outputs.prettier == 'true' | |
run: pnpm run build:prettier && pnpm run test --project prettier-config -u | |
- name: Update Stylelint Config Snapshot | |
if: needs.check-target-packages.outputs.stylelint == 'true' | |
run: pnpm run build:stylelint && pnpm run test --project stylelint-config -u | |
- name: Commit and Push Changes | |
run: | | |
git add . | |
git commit -m "chore: update snapshot (github-actions)" | |
git push origin HEAD | |
- name: Create change summary markdown | |
run: | | |
echo "## 🚚 Updated snapshots" >> CHANGES.md | |
if [ ${{ needs.check-target-packages.outputs.eslint }} == 'true' ]; then | |
echo "- ESLint" >> CHANGES.md | |
fi | |
if [ ${{ needs.check-target-packages.outputs.prettier }} == 'true' ]; then | |
echo "- Prettier" >> CHANGES.md | |
fi | |
if [ ${{ needs.check-target-packages.outputs.stylelint }} == 'true' ]; then | |
echo "- Stylelint" >> CHANGES.md | |
fi | |
- name: Comment to PR (Pull Request) | |
if: github.event_name == 'pull_request' | |
run: | | |
if [ ! -f CHANGES.md ]; then | |
echo "::warning::comment body not found." | |
exit 0 | |
fi | |
gh pr comment ${{ github.event.pull_request.number }} --body-file CHANGES.md --edit-last \ | |
|| gh pr comment ${{ github.event.pull_request.number}} --body-file CHANGES.md | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- name: Create Pull Request (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
if [ ! -f CHANGES.md ]; then | |
echo "::warning::comment body not found." | |
exit 0 | |
fi | |
gh pr create --base ${{ github.ref }} --body-file CHANGES.md --title "update snapshot (github-actions)" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} |