From 441aaff72c376f4f64e201fff11e4ec905aa41fc Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:39:38 +0100 Subject: [PATCH] ci(github): fix workflow config for deploy (#136) * ci(github): fix workflow config * ci(github): update deploy job * ci(github): fix PR label check --- .github/workflows/pr-labels.yml | 16 +++++++++++++--- .github/workflows/push.yml | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 49f5f27..36c23c8 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -9,14 +9,19 @@ jobs: is-properly-labeled: if: github.event.pull_request.merged == true runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write steps: - - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - name: Install requests run: pip install requests + - uses: actions/checkout@v4 - name: Process commit and find merger responsible for labeling id: commit - run: echo "::set-output name=merger::$(python .github/verify_labels.py ${{ github.event.pull_request.number }})" + run: | + MERGER=$(python .github/verify_labels.py ${{ github.event.pull_request.number }}) + echo "merger=${MERGER}" | tee --append $GITHUB_OUTPUT - name: Comment PR uses: actions/github-script@v7 if: ${{ steps.commit.outputs.merger != '' }} @@ -24,4 +29,9 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { issue: { number: issue_number }, repo: { owner, repo } } = context; - github.issues.createComment({ issue_number, owner, repo, body: 'Hey ${{ steps.commit.outputs.merger }} 👋\nYou merged this PR, but it is not correctly labeled. The list of valid labels is available at https://github.com/quack-ai/companion/blob/main/.github/verify_labels.py' }); + github.rest.issues.createComment({ + issue_number, + owner, + repo, + body: 'Hey ${{ steps.commit.outputs.merger }} 👋\nYou merged this PR, but it is not correctly labeled. The list of valid labels is available at https://github.com/quack-ai/contribution-api/blob/main/.github/verify_labels.py' + }); diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d029f39..1ac699c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -54,7 +54,7 @@ jobs: docker push $IMAGE_ID:latest deploy-dev: - needs: dockerhub + needs: docker runs-on: ubuntu-latest steps: - uses: appleboy/ssh-action@v1.0.3 @@ -65,7 +65,7 @@ jobs: script: | docker pull quackai/contribution-api:latest docker rmi -f $(docker images -f "dangling=true" -q) - cd devops && docker compose stop backend && docker compose up -d && docker compose exec backend alembic upgrade head + cd devops && docker compose stop backend && docker compose up -d --wait && docker compose exec backend alembic upgrade head docker inspect -f '{{ .Created }}' $(docker compose images -q backend) - name: Ping server env: