Skip to content

Commit

Permalink
Use gh pages action to delete previews (MetaMask#738)
Browse files Browse the repository at this point in the history
* Use gh pages action to delete previews

* Remove destination_dir option
  • Loading branch information
BelfordZ authored Apr 27, 2023
1 parent ae69fae commit cd9cb73
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/delete-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@ jobs:
delete_branch_folder_job:
runs-on: ubuntu-latest
needs: is-fork-pull-request
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }}
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' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Delete Branch Folder on gh-pages
if: ${{ 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' }}
run: |
git config --local user.name "Metamask Preview Bot"
git config --local user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git rm -r "${BRANCH_NAME}"
git commit -m "Delete ${BRANCH_NAME} folder from gh-pages branch"
git push origin gh-pages
- name: Delete preview build
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
run: rm -rf "${BRANCH_NAME}"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./
keep_files: false

0 comments on commit cd9cb73

Please sign in to comment.