chore: cleanup, ci workflows and formatting (#127064)
* ci: setup workflows, dependabot, labeler and commit linting * docs: update README, community files and issue templates * chore: configure prettier, editorconfig and format codebase * chore: restore changes lost during rebase * docs: adjust url for new logo * fix: align badges * chore: resolve conflicts and re-add temp lint
This commit is contained in:
parent
c2d978fd0a
commit
807efd502d
9 changed files with 6790 additions and 3547 deletions
112
.github/workflows/format-issue-bug.yml
vendored
Normal file
112
.github/workflows/format-issue-bug.yml
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
name: Format Issue Body
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
concurrency:
|
||||
group: issue-format-${{ github.event.issue.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'issues' && contains(github.event.issue.labels.*.name, 'bug')
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Parse issue form body
|
||||
uses: stefanbuck/github-issue-parser@v3
|
||||
id: parse
|
||||
with:
|
||||
template-path: .github/ISSUE_TEMPLATE/01-bug_report.yml
|
||||
|
||||
- name: Build formatted issue body
|
||||
id: summary
|
||||
env:
|
||||
DESCRIPTION: ${{ steps.parse.outputs.issueparser_description }}
|
||||
REPRODUCTION_STEPS: ${{ steps.parse.outputs.issueparser_reproduction_steps }}
|
||||
CODE_SAMPLE: ${{ steps.parse.outputs.issueparser_code_sample }}
|
||||
WHATSAPP_TYPE: ${{ steps.parse.outputs.issueparser_whatsapp_type }}
|
||||
AUTH_TYPE: ${{ steps.parse.outputs.issueparser_auth_type }}
|
||||
LIB_VERSION: ${{ steps.parse.outputs.issueparser_lib_version }}
|
||||
WWEB_VERSION: ${{ steps.parse.outputs.issueparser_wweb_version }}
|
||||
BROWSER_TYPE: ${{ steps.parse.outputs.issueparser_browser_type }}
|
||||
BROWSER_VERSION: ${{ steps.parse.outputs.issueparser_browser_version }}
|
||||
COMPUTER_OS: ${{ steps.parse.outputs.issueparser_computer_os }}
|
||||
PHONE_OS: ${{ steps.parse.outputs.issueparser_phone_os }}
|
||||
NODE_VERSION: ${{ steps.parse.outputs.issueparser_node_version }}
|
||||
CHECKLIST: ${{ steps.parse.outputs.issueparser_checklist }}
|
||||
run: |
|
||||
{
|
||||
echo 'body<<BODY_DELIMITER'
|
||||
echo '## Issue Description'
|
||||
echo "$DESCRIPTION"
|
||||
echo ''
|
||||
echo '## Reproduction Steps'
|
||||
echo "$REPRODUCTION_STEPS"
|
||||
echo ''
|
||||
if [ -n "$CODE_SAMPLE" ]; then
|
||||
echo '## Code Sample'
|
||||
echo "$CODE_SAMPLE"
|
||||
echo ''
|
||||
fi
|
||||
echo '## User Setup'
|
||||
echo ''
|
||||
echo '| WhatsApp | Type |'
|
||||
echo '|---|---|'
|
||||
[ -n "$WHATSAPP_TYPE" ] && echo "| **Account Type** | $WHATSAPP_TYPE |"
|
||||
[ -n "$AUTH_TYPE" ] && echo "| **Authentication Strategy** | $AUTH_TYPE |"
|
||||
[ -n "$WWEB_VERSION" ] && echo "| **WhatsApp Web Version** | $WWEB_VERSION |"
|
||||
[ -n "$LIB_VERSION" ] && echo "| **whatsapp-web.js Version** | $LIB_VERSION |"
|
||||
echo ''
|
||||
echo '| Environment | Version |'
|
||||
echo '|---|---|'
|
||||
[ -n "$BROWSER_TYPE" ] && echo "| **Browser Type** | $BROWSER_TYPE |"
|
||||
[ -n "$BROWSER_VERSION" ] && echo "| **Browser Version** | $BROWSER_VERSION |"
|
||||
[ -n "$PHONE_OS" ] && echo "| **Phone OS Version** | $PHONE_OS |"
|
||||
[ -n "$COMPUTER_OS" ] && echo "| **Running OS Version** | $COMPUTER_OS |"
|
||||
[ -n "$NODE_VERSION" ] && echo "| **Node.js Version** | $NODE_VERSION |"
|
||||
echo ''
|
||||
if [ -n "$CHECKLIST" ]; then
|
||||
echo '## Checklist'
|
||||
echo '- [x] **I use the latest released version of whatsapp-web.js.**'
|
||||
echo '- [x] I have searched existing issues and confirmed this is not a duplicate.'
|
||||
echo '- [x] I have verified this is a library issue, not a problem with my code.'
|
||||
fi
|
||||
echo 'BODY_DELIMITER'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Update issue body
|
||||
uses: julien-deramond/update-issue-body@v1
|
||||
with:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: ${{ steps.summary.outputs.body }}
|
||||
edit-mode: replace
|
||||
|
||||
- name: Determine priority label
|
||||
id: priority_label
|
||||
env:
|
||||
PRIORITY: ${{ steps.parse.outputs.issueparser_priority }}
|
||||
run: |
|
||||
if [[ "$PRIORITY" == "Low"* ]]; then
|
||||
echo "label=issued low" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "$PRIORITY" == "Medium"* ]]; then
|
||||
echo "label=issued medium" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "$PRIORITY" == "High"* ]]; then
|
||||
echo "label=issued high" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Add priority label
|
||||
if: steps.priority_label.outputs.label != ''
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: ${{ steps.priority_label.outputs.label }}
|
||||
24
.github/workflows/issue-triage.yml
vendored
Normal file
24
.github/workflows/issue-triage.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: Issue Triage
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
concurrency:
|
||||
group: issue-${{ github.event.issue.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label issue
|
||||
uses: github/issue-labeler@v3.4
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
configuration-path: .github/issue-labeler.yml
|
||||
enable-versioned-regex: 0
|
||||
29
.github/workflows/labels-sync.yml
vendored
Normal file
29
.github/workflows/labels-sync.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: Sync Labels
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 */3 * *'
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/labels.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
concurrency:
|
||||
group: label-sync
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
label-sync:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'pedroslopez'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: crazy-max/ghaction-github-labeler@v5
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
30
.github/workflows/lint.yml
vendored
30
.github/workflows/lint.yml
vendored
|
|
@ -1,20 +1,20 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
name: ESLint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install node v14
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Run ESLint
|
||||
run: ./node_modules/.bin/eslint .
|
||||
eslint:
|
||||
name: ESLint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install node v14
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Run ESLint
|
||||
run: ./node_modules/.bin/eslint .
|
||||
|
|
|
|||
49
.github/workflows/pr-triage.yml
vendored
Normal file
49
.github/workflows/pr-triage.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
name: PR Triage
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- synchronize
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: pr-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
label:
|
||||
name: Label PR
|
||||
if: github.event.action != 'edited'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label pull request
|
||||
uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
configuration-path: .github/pr-labeler.yml
|
||||
dot: true
|
||||
sync-labels: true
|
||||
|
||||
validate-title:
|
||||
name: Validate title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Validate pull request title
|
||||
env:
|
||||
TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types|infra)(\\(.+\\))?!?: .{1,72}$"
|
||||
|
||||
echo "Title: \"$TITLE\""
|
||||
|
||||
shopt -s nocasematch
|
||||
if [[ ! "$TITLE" =~ $REGEX ]]; then
|
||||
echo "❌ PR title does not match the required format!"
|
||||
exit 1
|
||||
fi
|
||||
84
.github/workflows/release.yml
vendored
84
.github/workflows/release.yml
vendored
|
|
@ -1,37 +1,55 @@
|
|||
name: release
|
||||
name: Release a New Version
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_type:
|
||||
description: "`alpha`, `alpha-minor`, `alpha-major`, `release-minor`, `release-patch` release?"
|
||||
required: true
|
||||
default: "alpha"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_type:
|
||||
description: 'Release type'
|
||||
required: true
|
||||
default: 'alpha'
|
||||
type: choice
|
||||
options:
|
||||
- alpha
|
||||
- alpha-minor
|
||||
- alpha-major
|
||||
- release-minor
|
||||
- release-patch
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'pedroslopez/whatsapp-web.js' }}
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: git config --global user.email "hello@wwebjs.dev"
|
||||
- run: git config --global user.name "WWebJS Bot"
|
||||
- name: Bump version and publish to NPM
|
||||
id: publish
|
||||
run: ./tools/publish ${{ github.event.inputs.release_type }}
|
||||
- name: Create GitHub Release
|
||||
id: create_release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
prerelease: ${{ steps.publish.outputs.PRERELEASE }}
|
||||
generateReleaseNotes: true
|
||||
tag: v${{ steps.publish.outputs.NEW_VERSION }}
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'pedroslopez/whatsapp-web.js'
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.email "hello@wwebjs.dev"
|
||||
git config --global user.name "WWebJS Bot"
|
||||
|
||||
- name: Bump version and publish to NPM
|
||||
id: publish
|
||||
run: ./tools/publish ${{ inputs.release_type }}
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
prerelease: ${{ steps.publish.outputs.PRERELEASE }}
|
||||
generateReleaseNotes: true
|
||||
tag: v${{ steps.publish.outputs.NEW_VERSION }}
|
||||
|
|
|
|||
42
.github/workflows/stale.yml
vendored
Normal file
42
.github/workflows/stale.yml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: Mark Stale Issues and PRs
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: stale
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
if: github.repository_owner == 'pedroslopez'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mark stale issues and PRs
|
||||
uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 35
|
||||
days-before-close: 7
|
||||
stale-issue-label: 'stale'
|
||||
stale-pr-label: 'stale'
|
||||
start-date: '2026-03-03T00:00:00Z'
|
||||
remove-stale-when-updated: true
|
||||
exempt-issue-labels: 'pinned,security,feature request,issued high'
|
||||
exempt-pr-labels: 'pinned,security,whatsapp change,approved,waiting for testers'
|
||||
stale-issue-message: >
|
||||
Marking this issue as stale due to inactivity. Comment or update the issue to
|
||||
keep it open. It will be closed in 7 days otherwise. Thank you for your contributions.
|
||||
stale-pr-message: >
|
||||
Marking this pull request as stale due to inactivity. Push changes or comment
|
||||
to keep it open. It will be closed in 7 days otherwise. Thank you for your contributions.
|
||||
close-issue-message: >
|
||||
Closing this issue due to inactivity. Feel free to reopen if it is still relevant.
|
||||
close-pr-message: >
|
||||
Closing this pull request due to inactivity. You can reopen it anytime to continue.
|
||||
28
.github/workflows/tests.yml
vendored
Normal file
28
.github/workflows/tests.yml
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run Eslint
|
||||
run: npm run lint
|
||||
81
.github/workflows/update.yml
vendored
81
.github/workflows/update.yml
vendored
|
|
@ -1,39 +1,54 @@
|
|||
name: Update
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 12 * * 0"
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 12 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: wa-update
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./tools/version-checker
|
||||
update:
|
||||
if: github.repository_owner == 'pedroslopez'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./tools/version-checker
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install node v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Run Updater
|
||||
run: ./update-version
|
||||
- name: Store WA Version
|
||||
run: echo WA_VERSION=`cat ./.version` >> $GITHUB_ENV
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
branch: auto-wa-web-update/patch
|
||||
delete-branch: true
|
||||
commit-message: Update supported WhatsApp Web version to v${{ env.WA_VERSION }}
|
||||
title: Update WhatsApp Web Version (${{ env.WA_VERSION }})
|
||||
body: |
|
||||
A new version of WhatsApp Web has been detected!
|
||||
|
||||
Tests should be run against this new version before merging.
|
||||
labels: WhatsApp Change
|
||||
reviewers: pedroslopez
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run Updater
|
||||
run: ./update-version
|
||||
|
||||
- name: Store WA Version
|
||||
run: echo "WA_VERSION=$(cat ./.version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
branch: auto-wa-web-update/patch
|
||||
delete-branch: true
|
||||
commit-message: 'chore: update supported WhatsApp Web version to v${{ env.WA_VERSION }}'
|
||||
title: 'chore: update WhatsApp Web version (${{ env.WA_VERSION }})'
|
||||
body: |
|
||||
A new version of WhatsApp Web has been detected!
|
||||
|
||||
Tests should be run against this new version before merging.
|
||||
labels: whatsapp change
|
||||
reviewers: pedroslopez
|
||||
|
|
|
|||
Loading…
Reference in a new issue