Skip to content

Example/test maintenance (package-lock updating, formatting, linting) #1

Example/test maintenance (package-lock updating, formatting, linting)

Example/test maintenance (package-lock updating, formatting, linting) #1

Workflow file for this run

name: Example/test maintenance (package-lock updating, formatting, linting)
on:
workflow_dispatch:
inputs:
signing-key-id:
required: true
type: string
default: C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
jobs:
create-branch-prefix:
uses: ./.github/workflows/create_branch_prefix.yml
with:
prefix: 'maintenance'
version: $(jq -r '.version' package.json)
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
prepare-maintenance:
name: Prepare Maintenance
needs:
- create-branch-prefix
runs-on: ubuntu-latest
outputs:
test-infos: ${{ steps.get-test-infos.outputs.test-infos }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- uses: ./.github/actions/setup_node
- run: npm install
# Run global prettier/lint fixes
- name: Run Prettier
run: npx prettier --write .
- name: Run ESLint
run: npx eslint . --fix
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ needs.create-branch-prefix.outputs.base-branch }}
commit-message: 'Example/test maintenance: formatting and linting'
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
signing-key-id: ${{ inputs.signing-key-id }}
- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: ./examples
update-test-dependencies:
needs:
- prepare-maintenance
- create-branch-prefix
name: Update dependencies for ${{ matrix.test.name }}
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.prepare-maintenance.outputs.test-infos) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- uses: ./.github/actions/setup_node
# Update package-lock.json in test directory
- name: Update package-lock.json
working-directory: ${{ matrix.test.path }}
run: |
rm -f package-lock.json
npm install
- name: Create branch name
id: create-branch-name
uses: ./.github/actions/create_branch_name
with:
prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
path: ${{ matrix.test.displayPath }}
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ steps.create-branch-name.outputs.branch-name }}
commit-message: 'Example/test maintenance: update dependencies'
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
create-branch: 'true'
signing-key-id: ${{ inputs.signing-key-id }}
squash-branches:
needs:
- update-test-dependencies
- create-branch-prefix
uses: ./.github/workflows/squash_branches.yml
with:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
commit-message: 'Example/test maintenance: update dependencies'
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
create-pr:
needs:
- squash-branches
- create-branch-prefix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
gh pr create \
--base main \
--head ${{ needs.create-branch-prefix.outputs.base-branch }} \
--title "Example/test maintenance: update dependencies, formatting, and linting" \
--body "Automated PR for maintenance tasks:
- Updated package-lock.json files
- Fixed formatting with Prettier
- Fixed linting issues with ESLint"