Skip to content

@PR • Lint Commits triggered by ldg-smartling-sa on branch smartling-translations-20241120150710031 #38668

@PR • Lint Commits triggered by ldg-smartling-sa on branch smartling-translations-20241120150710031

@PR • Lint Commits triggered by ldg-smartling-sa on branch smartling-translations-20241120150710031 #38668

Workflow file for this run

name: "@PR • Lint Commits"
run-name: "@PR • Lint Commits triggered by ${{ inputs.login }} ${{ format('on branch {0}', inputs.ref) }}"
on:
workflow_dispatch:
inputs:
ref:
description: The commit/branch to lint
required: true
from:
description: Lower end of the commit range to lint
required: true
login:
description: The GitHub username that triggered the workflow
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
lint-commits:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
- name: Setup the toolchain
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop
with:
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
region: ${{ secrets.AWS_CACHE_REGION }}
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
- name: Install dependencies
run: pnpm i --filter="ledger-live"
- name: Lint commits
run: |
set -o pipefail
pnpm commitlint --from ${{ inputs.from && format('origin/{0}', inputs.from) || 'HEAD^1' }} 2>&1 | tee commitlint.out
- uses: actions/upload-artifact@v4
name: upload commitlint output
if: ${{ !cancelled() }}
with:
name: commitlint
path: ${{ github.workspace }}/commitlint.out
report:
runs-on: ubuntu-22.04
needs: [lint-commits]
if: ${{ !cancelled() }}
steps:
- name: download commitlint output
uses: actions/download-artifact@v4
with:
name: commitlint
- uses: actions/github-script@v7
name: format summary
id: status
with:
script: |
const fs = require("fs");
const status = "${{ needs.lint-commits.result }}";
const linterOutput = fs.readFileSync("commitlint.out", "utf-8");
let summary = ``;
if(status === "success") {
summary += `### 📝 Commit messages are well formatted\n`;
summary += `\n`;
summary += `Everything looks good. Kudos! 👍\n`;
} else if(status === "failure")
{
summary += `### 🚨 Invalid commit message(s)\n`;
summary += `\n`;
summary += `One or more commits messages are not formatted correctly.\n`;
summary += `Please rewrite the git history and reword the commit messages in order to fix this issue. 🙏\n`;
summary += `\n`;
summary += `#### 💡 Tips:\n`;
summary += `\n`;
summary += `- Run \`pnpm commitlint --from <target branch>\` locally to test your branch.\n`;
summary += `- Run \`pnpm commit\` will run a prompt that can walk you through writing a correct commit message.\n`
summary += `- If you are not comfortable with git and \`git rebase --interactive\`, here is a [nice tutorial](https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history).\n`;
summary += `\n`;
summary += `### Commitlint output\n`;
summary += `\n`;
summary += `\`\`\`\n${linterOutput}\n\`\`\`\n`;
} else {
summary += `⚠️ Unable to lint commits: ${status}`;
}
const output = {
summary
}
fs.writeFileSync("summary.json", JSON.stringify(output), "utf-8");
- uses: actions/upload-artifact@v4
name: upload output
with:
path: ${{ github.workspace }}/summary.json
name: summary.json