Bump @babel/traverse from 7.22.8 to 7.23.2 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish a preview build | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
is-fork-pull-request: | |
name: Determine whether this pull request is from a fork | |
runs-on: ubuntu-latest | |
outputs: | |
IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine whether this PR is from a fork | |
id: is-fork | |
run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
get-commit-hash: | |
name: Get the commit hash for the commit being previewed | |
needs: is-fork-pull-request | |
# This ensures we don't publish on forks. We can't trust forks to publish on our domain. | |
# also ensures we dont publish previews to folders that are already used | |
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' && github.event.pull_request.head.ref != 'wallet' && github.event.pull_request.head.ref != 'snaps' && github.event.pull_request.head.ref != 'guide' && github.event.pull_request.head.ref != 'assets' && github.event.pull_request.head.ref != 'img' && github.event.pull_request.head.ref != 'search' }} | |
runs-on: ubuntu-latest | |
outputs: | |
COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout pull request | |
run: gh pr checkout "${PR_NUMBER}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
- name: Get commit SHA | |
id: commit-sha | |
run: echo "COMMIT_SHA=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Ensure commit hash is not empty | |
if: ${{ steps.commit-sha.outputs.COMMIT_SHA == '' }} | |
run: exit 1 | |
publish-to-gh-pages: | |
name: Publish docs to commit hash directory of `gh-pages` branch | |
needs: get-commit-hash | |
permissions: | |
contents: write | |
uses: ./.github/workflows/publish-docs.yml | |
with: | |
destination_dir: ${{ github.head_ref }} | |
ref: ${{ needs.get-commit-hash.outputs.COMMIT_SHA }} | |
post-preview-comment: | |
name: Post preview in comment | |
needs: | |
- get-commit-hash | |
- publish-to-gh-pages | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Post preview in comment | |
run: gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" | |
env: | |
COMMENT_BODY: "Preview published: [${{ github.head_ref }}](https://docs.metamask.io/${{ github.head_ref }}/)" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} |