From 2c2f2b20b924522c000261af80e1b00fd6243ea8 Mon Sep 17 00:00:00 2001 From: Olivier Zalmanski <88216225+OlivierZal@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:16:50 +0100 Subject: [PATCH] fix gh actions --- .github/workflows/dependabot.yml | 2 +- .github/workflows/validate.yml | 17 +++++++++-------- lib/addToLogs.mts | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 9dbf7d5d..fc074ba4 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -15,7 +15,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --merge "$PR_URL" + run: gh pr merge --auto --merge --delete-branch "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2bd880f2..fe98b1f3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -4,13 +4,14 @@ on: push: branches: main workflow_dispatch: +permissions: + contents: write + packages: read + pull-requests: write jobs: validate: name: Validate app runs-on: ubuntu-latest - strategy: - matrix: - node-version: ['16.x', '18.x', 'latest'] if: github.actor != 'dependabot[bot]' steps: - uses: actions/checkout@v4 @@ -18,7 +19,7 @@ jobs: ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 'latest' registry-url: https://npm.pkg.github.com scope: '@olivierzal' cache: 'npm' @@ -26,13 +27,11 @@ jobs: run: npm ci env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - npm_config_ignore_scripts: ${{ matrix.node-version == '16.x' }} - name: Build code & validate app uses: athombv/github-action-homey-app-validate@master with: level: publish - name: Commit & push changes - if: matrix.node-version == 'latest' run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -40,14 +39,16 @@ jobs: if ! git diff --cached --exit-code; then git commit -m "Code maintenance: lint, format and build code" if [[ ${{ github.ref }} == "refs/heads/main" ]]; then - echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token BRANCH_NAME="maintenance-$(date +'%Y%m%d%H%M%S')" git checkout -b "$BRANCH_NAME" git push origin "$BRANCH_NAME" gh pr create --base main --head "$BRANCH_NAME" --title "Maintenance PR" --body "Automatic code maintenance: lint, format and build code." - gh pr merge --auto --squash --delete-branch ${{ github.event.pull_request.html_url }} + PR_URL=$(gh pr view "$BRANCH_NAME" --json url -q '.url') + gh pr merge --auto --merge --delete-branch "$PR_URL" else git pull origin ${{ github.head_ref }} --rebase git push origin HEAD:${{ github.head_ref }} fi fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/lib/addToLogs.mts b/lib/addToLogs.mts index 4b0de11c..cf3b92ff 100644 --- a/lib/addToLogs.mts +++ b/lib/addToLogs.mts @@ -7,7 +7,7 @@ export const addToLogs = SimpleClass>(...logs: string[]) => (target: T, _context: ClassDecoratorContext): T => { abstract class LogDecorator extends target { - public override error(...args: unknown[]): void { + public override error(...args: unknown[]): void { this.#commonLog('error', ...args) }