From c482bdbc5ebab0239580baaf9dc98ebcbcdf55a7 Mon Sep 17 00:00:00 2001 From: Vieltojarvi Date: Tue, 19 Nov 2024 13:18:46 -0800 Subject: [PATCH 1/3] actions use env variables --- .github/workflows/build.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c7e9a2..c7dc67a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,19 +37,22 @@ jobs: - if: steps.git_diff.outputs.has_changes name: Commit and push changes (if changed) run: 'git add . && git commit -m "chore: self mutation" && git push origin - HEAD:${{ github.event.pull_request.head.ref }}' + HEAD:"$PR-HEAD-REF"' + env: + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - if: steps.git_diff.outputs.has_changes name: Update status check (if changed) - run: gh api -X POST /repos/${{ github.event.pull_request.head.repo.full_name - }}/check-runs -F name="build" -F head_sha="$(git rev-parse HEAD)" -F + run: gh api -X POST /repos/"$REPO_FULL_NAME"/check-runs + -F name="build" -F head_sha="$(git rev-parse HEAD)" -F status="completed" -F conclusion="success" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} - if: steps.git_diff.outputs.has_changes name: Cancel workflow (if changed) - run: gh api -X POST /repos/${{ github.event.pull_request.head.repo.full_name - }}/actions/runs/${{ github.run_id }}/cancel + run: gh api -X POST /repos/"$REPO_FULL_NAME"/actions/runs/${{ github.run_id }}/cancel env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} container: image: jsii/superchain:1-buster-slim-node14 From c2b28dc8fab9f2543273d0e2ddbbcab4f7e3578d Mon Sep 17 00:00:00 2001 From: Vieltojarvi Date: Tue, 19 Nov 2024 13:39:15 -0800 Subject: [PATCH 2/3] changed names, removed quotes --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7dc67a..9f04733 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,17 +42,17 @@ jobs: PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - if: steps.git_diff.outputs.has_changes name: Update status check (if changed) - run: gh api -X POST /repos/"$REPO_FULL_NAME"/check-runs + run: gh api -X POST /repos/$REPO_FULL_NAME/check-runs -F name="build" -F head_sha="$(git rev-parse HEAD)" -F status="completed" -F conclusion="success" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} + PR_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} - if: steps.git_diff.outputs.has_changes name: Cancel workflow (if changed) - run: gh api -X POST /repos/"$REPO_FULL_NAME"/actions/runs/${{ github.run_id }}/cancel + run: gh api -X POST /repos/$REPO_FULL_NAME/actions/runs/${{ github.run_id }}/cancel env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} + PR_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} container: image: jsii/superchain:1-buster-slim-node14 From b3138fb1a94a143db2440e1996e902fc9e7b2ec2 Mon Sep 17 00:00:00 2001 From: Vieltojarvi Date: Tue, 19 Nov 2024 13:41:41 -0800 Subject: [PATCH 3/3] added brackets and updated env var name in call --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f04733..fd5316e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - if: steps.git_diff.outputs.has_changes name: Update status check (if changed) - run: gh api -X POST /repos/$REPO_FULL_NAME/check-runs + run: gh api -X POST /repos/${PR_REPO_FULL_NAME}/check-runs -F name="build" -F head_sha="$(git rev-parse HEAD)" -F status="completed" -F conclusion="success" env: @@ -50,7 +50,7 @@ jobs: PR_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}} - if: steps.git_diff.outputs.has_changes name: Cancel workflow (if changed) - run: gh api -X POST /repos/$REPO_FULL_NAME/actions/runs/${{ github.run_id }}/cancel + run: gh api -X POST /repos/${PR_REPO_FULL_NAME}/actions/runs/${{ github.run_id }}/cancel env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name}}