From 1c96d0289ed0bb5d209beb1ebaaf1a0aa93309b6 Mon Sep 17 00:00:00 2001 From: Andrea Mattioli Date: Wed, 31 Jan 2024 16:09:30 +0000 Subject: [PATCH] add github wf --- .github/workflows/cron.yml | 21 +++++++++++++ .github/workflows/pr-artifacts.yml | 47 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/cron.yml create mode 100644 .github/workflows/pr-artifacts.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 0000000..8ec4826 --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,21 @@ +name: Cron actions + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + validate: + runs-on: "ubuntu-latest" + name: Validate + steps: + - uses: "actions/checkout@v4" + + - name: HACS validation + uses: "hacs/action@main" + with: + category: "integration" + ignore: brands + + - name: Hassfest validation + uses: "home-assistant/actions/hassfest@master" diff --git a/.github/workflows/pr-artifacts.yml b/.github/workflows/pr-artifacts.yml new file mode 100644 index 0000000..111f01d --- /dev/null +++ b/.github/workflows/pr-artifacts.yml @@ -0,0 +1,47 @@ +name: PR artifacts + +on: + pull_request: + branches: + - main + +jobs: + create: + permissions: + # Required to upload/save artifact, otherwise you'll get + # "Error: Resource not accessible by integration" + contents: write + # Required to post comment, otherwise you'll get + # "Error: Resource not accessible by integration" + pull-requests: write + + runs-on: ubuntu-latest + steps: + - name: 📥 Checkout the repository + uses: actions/checkout@v4 + + - name: 📦 Create zip file for the integration + run: | + cd "${{ github.workspace }}/custom_components/bticino_x8000" + zip bticino_x8000.zip -r ./ + mv bticino_x8000.zip "${{ github.workspace }}/" + + - name: 📤 Create comment with the artifiactory + uses: gavv/pull-request-artifacts@v2 + with: + # Commit hash that triggered PR + commit: ${{ github.event.pull_request.head.sha }} + + # Token for current repo (used to post PR comment) + repo-token: ${{ secrets.GITHUB_TOKEN }} + + artifacts-branch: artifacts + + comment-title: | + 🤖 Pull request artifactsy + + For testing please download the zip file below and extract it in `[config folder]/custom_components/bticino_x8000`. + + # Whitespace-separated list of files to upload + artifacts: | + bticino_x8000.zip