diff --git a/.github/workflows/test-lint-changelog.yml b/.github/workflows/test-lint-changelog.yml index 66c0219551f4..9e8ee0e992c8 100644 --- a/.github/workflows/test-lint-changelog.yml +++ b/.github/workflows/test-lint-changelog.yml @@ -15,9 +15,13 @@ jobs: uses: metamask/github-tools/.github/actions/setup-environment@main - name: Validate changelog + # For a `pull_request` event, the branch is `github.head_ref``. + # For a `push` event, the branch is `github.ref_name`. if: ${{ !startsWith(github.head_ref || github.ref_name, 'Version-v') }} run: yarn lint:changelog - name: Validate release candidate changelog + # For a `pull_request` event, the branch is `github.head_ref``. + # For a `push` event, the branch is `github.ref_name`. if: ${{ startsWith(github.head_ref || github.ref_name, 'Version-v') }} run: .circleci/scripts/validate-changelog-in-rc.sh diff --git a/.github/workflows/wait-for-circleci-workflow-status.yml b/.github/workflows/wait-for-circleci-workflow-status.yml index 725a4c3b975d..30efc6d35776 100644 --- a/.github/workflows/wait-for-circleci-workflow-status.yml +++ b/.github/workflows/wait-for-circleci-workflow-status.yml @@ -12,14 +12,15 @@ jobs: env: OWNER: ${{ github.repository_owner }} REPOSITORY: ${{ github.event.repository.name }} + # For a `pull_request` event, the branch is `github.head_ref``. + # For a `push` event, the branch is `github.ref_name`. BRANCH: ${{ github.head_ref || github.ref_name }} - # For a `push` event, the HEAD commit hash is `github.sha`. - # For a `pull_request` event, `github.sha` is instead the base branch commit hash. The - # HEAD commit hash is `pull_request.head.sha`. + # For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`. + # For a `push` event, the head commit hash is `github.sha`. HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }} run: | - pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq -r ".items | map(select(.vcs.revision == \"${HEAD_COMMIT_HASH}\" )) | first | .id") - echo "Waiting for pipeline '${pipeline_id}' for commit hash '${HEAD_COMMIT_HASH}'" + pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first | .id') + echo "Waiting for pipeline '${pipeline_id}', commit hash '${HEAD_COMMIT_HASH}'" workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].status") if [ "$workflow_status" == "running" ]; then