From 42de58bcbedb5661d261a1359f18e019e685146d Mon Sep 17 00:00:00 2001 From: ext-vradulescu Date: Wed, 20 Nov 2024 15:00:17 +0200 Subject: [PATCH] Acquire Lock - switched from main to aquire-lock branch --- .github/workflows/accept-baseline.yml | 34 ++++++++------------------- .github/workflows/run-tests.yml | 2 ++ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/.github/workflows/accept-baseline.yml b/.github/workflows/accept-baseline.yml index 7a8bf293..aec6bfc4 100644 --- a/.github/workflows/accept-baseline.yml +++ b/.github/workflows/accept-baseline.yml @@ -41,7 +41,7 @@ jobs: - name: Verify Approvals run: | APPROVALS=$(gh pr view ${{ github.event.pull_request.number }} --json reviews --jq '[.reviews[] | select(.state=="APPROVED")] | length') - if [[ "$APPROVALS" -lt 2 ]]; then + if [[ "$APPROVALS" -lt 1 ]]; then echo "Not enough approvals. Exiting." exit 1 fi @@ -127,41 +127,27 @@ jobs: env: GI_KEY: ${{ secrets.GI_KEY }} + auto-merge: + needs: update-baselines + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Release Lock if: success() run: | git config user.name "github-actions" git config user.email "actions@github.com" - + git pull origin aquire-lock - + git rm .baseline-lock git commit -m "Release lock for baseline update [skip husky]" git push origin aquire-lock env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Update Snapshots Check Status - if: success() - run: | - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/bitdefender/www-landing-pages/statuses/${{ github.event.pull_request.head.sha }} \ - -d '{ - "state":"success", - "target_url":"https://github.com/bitdefender/www-landing-pages/actions/runs/${{ github.run_id }}","description":"The build succeeded!","context":"Run Tests and Snapshots / snapshots-tests (pull_request)"}' - - - auto-merge: - needs: update-baselines - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Auto-Merge PR if: success() run: gh pr merge ${{ github.event.pull_request.number }} --squash --admin diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c61e92d4..fa937ff1 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,6 +22,7 @@ jobs: lint: needs: setup-nodejs runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} steps: - uses: actions/checkout@v3 - run: npm install @@ -30,6 +31,7 @@ jobs: unit-tests: needs: setup-nodejs runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} steps: - uses: actions/checkout@v3 - run: npm install