Skip to content

Commit

Permalink
fix gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierZal committed Nov 15, 2024
1 parent a96df0b commit 2c2f2b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
17 changes: 9 additions & 8 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,51 @@ 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
with:
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'
- name: Lint & format code
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"
git add -A
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 }}
2 changes: 1 addition & 1 deletion lib/addToLogs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const addToLogs =
<T extends abstract new (...args: any[]) => 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)
}

Expand Down

0 comments on commit 2c2f2b2

Please sign in to comment.