From f52abc26e582217f6b42e25a4309a937f720541f Mon Sep 17 00:00:00 2001 From: Abdel-Monaam-Aouini Date: Tue, 27 Jun 2023 09:30:53 +0100 Subject: [PATCH 1/2] feat: add workflows PR & master --- .github/dependabot.yml | 11 ++++++ .github/workflows/master.yml | 40 ++++++++++++++++++++ .github/workflows/pr.yml | 71 ++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4165e15 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# .github/dependabot.yml +version: 2 +updates: + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'daily' + commit-message: + prefix: feat + prefix-development: feat + open-pull-requests-limit: 99 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..69082d1 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,40 @@ +name: Master + +on: + push: + branches: [ "master" ] + +permissions: + contents: write + id-token: write + +jobs: + linting: + name: linting + runs-on: ubuntu-latest + environment: testing + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: npm ci + - name: format + run: npm run format + - name: lint + run: npm run lint + - name: prettify + run: npm run pret + + test: + name: Test + runs-on: ubuntu-22.04 + environment: testing + steps: + - name: 👌🏻 Checkout + uses: actions/checkout@v3 + - name: 👌🏻 Setup and build + run: | + npm ci + npm run build + - name: 🔎 Run tests + run: npm run test --if-present \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..f407650 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,71 @@ +name: PR + +on: + pull_request: + types: + - opened + - edited + - synchronize + +permissions: + contents: write + id-token: write + pull-requests: write + +jobs: + linting: + name: linting + runs-on: ubuntu-latest + environment: testing + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: npm ci + - name: format + run: npm run format + - name: lint + run: npm run lint + - name: prettify + run: npm run pret + + test: + name: Test + runs-on: ubuntu-22.04 + environment: testing + steps: + - name: 👌🏻 Checkout + uses: actions/checkout@v3 + - name: 👌🏻 Setup and build + run: | + npm ci + npm run build + - name: 🔎 Run tests + run: npm run test --if-present + + set-automerge: + name: Approve and automerge (only dependanbot PRs) + runs-on: ubuntu-latest + environment: testing + needs: [test, deploy] + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Enable auto-merge for Dependabot PRs + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4f1e79b23d879dd9c72e2f8c79e470549b664197 Mon Sep 17 00:00:00 2001 From: Abdel-Monaam-Aouini Date: Tue, 27 Jun 2023 09:42:39 +0100 Subject: [PATCH 2/2] fix: style --- .github/dependabot.yml | 16 ++--- .github/workflows/master.yml | 64 +++++++++--------- .github/workflows/pr.yml | 125 ++++++++++++++++++----------------- 3 files changed, 103 insertions(+), 102 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4165e15..4dcf445 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,11 @@ # .github/dependabot.yml version: 2 updates: - - package-ecosystem: 'npm' - directory: '/' - schedule: - interval: 'daily' - commit-message: - prefix: feat - prefix-development: feat - open-pull-requests-limit: 99 + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: feat + prefix-development: feat + open-pull-requests-limit: 99 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 69082d1..35bb510 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -1,40 +1,40 @@ name: Master on: - push: - branches: [ "master" ] + push: + branches: ["master"] permissions: - contents: write - id-token: write + contents: write + id-token: write jobs: - linting: - name: linting - runs-on: ubuntu-latest - environment: testing - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install dependencies - run: npm ci - - name: format - run: npm run format - - name: lint - run: npm run lint - - name: prettify - run: npm run pret + linting: + name: linting + runs-on: ubuntu-latest + environment: testing + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: npm ci + - name: format + run: npm run format + - name: lint + run: npm run lint + - name: prettify + run: npm run pret - test: - name: Test - runs-on: ubuntu-22.04 - environment: testing - steps: - - name: 👌🏻 Checkout - uses: actions/checkout@v3 - - name: 👌🏻 Setup and build - run: | - npm ci - npm run build - - name: 🔎 Run tests - run: npm run test --if-present \ No newline at end of file + test: + name: Test + runs-on: ubuntu-22.04 + environment: testing + steps: + - name: 👌🏻 Checkout + uses: actions/checkout@v3 + - name: 👌🏻 Setup and build + run: | + npm ci + npm run build + - name: 🔎 Run tests + run: npm run test --if-present diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f407650..7b52b1a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,71 +1,72 @@ name: PR on: - pull_request: - types: - - opened - - edited - - synchronize + pull_request: + types: + - opened + - edited + - synchronize permissions: - contents: write - id-token: write - pull-requests: write + contents: write + id-token: write + pull-requests: write jobs: - linting: - name: linting - runs-on: ubuntu-latest - environment: testing - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install dependencies - run: npm ci - - name: format - run: npm run format - - name: lint - run: npm run lint - - name: prettify - run: npm run pret + linting: + name: linting + runs-on: ubuntu-latest + environment: testing + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: npm ci + - name: format + run: npm run format + - name: lint + run: npm run lint + - name: prettify + run: npm run pret - test: - name: Test - runs-on: ubuntu-22.04 - environment: testing - steps: - - name: 👌🏻 Checkout - uses: actions/checkout@v3 - - name: 👌🏻 Setup and build - run: | - npm ci - npm run build - - name: 🔎 Run tests - run: npm run test --if-present + test: + name: Test + runs-on: ubuntu-22.04 + environment: testing + steps: + - name: 👌🏻 Checkout + uses: actions/checkout@v3 + - name: 👌🏻 Setup and build + run: | + npm ci + npm run build + - name: 🔎 Run tests + run: npm run test --if-present - set-automerge: - name: Approve and automerge (only dependanbot PRs) - runs-on: ubuntu-latest - environment: testing - needs: [test, deploy] - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Dependabot metadata - id: dependabot-metadata - uses: dependabot/fetch-metadata@v1.1.1 - with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Approve a PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Enable auto-merge for Dependabot PRs - if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + set-automerge: + name: Approve and automerge (only dependanbot PRs) + runs-on: ubuntu-latest + environment: testing + needs: [test, linting] + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Enable auto-merge for Dependabot PRs + if: + ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}} + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}