Skip to content

test

test #38

Workflow file for this run

name: Validate app
on:
push:
branches: main
pull_request:
types: [opened, reopened, synchronize]
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
- name: Update package version
run: |
APP_VERSION=$(jq -r .version .homeycompose/app.json)
jq ".version=\"$APP_VERSION\"" package.json > package.json.tmp
mv package.json.tmp package.json
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: https://npm.pkg.github.com
scope: '@olivierzal'
cache: 'npm'
- name: Install dependencies, update package-lock.json, lint & format code
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate app
uses: athombv/github-action-homey-app-validate@master
with:
level: publish
- name: Commit & push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add -A
if ! git diff --cached --exit-code; then
git commit -m "Code maintenance: update package version, 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: update package version, lint, format and build code."
gh pr merge --auto --squash --delete-branch ${{ github.event.pull_request.html_url }}
else
git pull origin ${{ github.head_ref }} --rebase
git push origin HEAD:${{ github.head_ref }}
fi
else
echo "No changes to commit."
fi