Drop becoming-an-infrastructure-team-member page #547
Workflow file for this run
This file contains hidden or 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: Remove preview | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| contents: write | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| jobs: | |
| remove: | |
| name: "Remove preview build" | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ovirt-site-preview-build | |
| cancel-in-progress: false | |
| steps: | |
| - name: set git defaults | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| - name: Checkout gh-pages branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract PR details | |
| id: details | |
| run: | | |
| PR_ID=${{ github.event.pull_request.number }} | |
| PREVIEW_PATH=previews/${PR_ID} | |
| PREVIEW_LINK=https://$(echo "${{github.repository}}" | sed -e 's#/#.github.io/#')/${PREVIEW_PATH} | |
| PREVIEW_LINK_PATH="$(echo $PREVIEW_LINK | sed -e 's#.*\.io/#/#')" | |
| PREVIEW_LINK_BASE="$(echo $PREVIEW_LINK | sed -e 's#\.io.*#.io#')" | |
| echo "PR_ID=${PR_ID}" >> $GITHUB_OUTPUT | |
| echo "PREVIEW_PATH=${PREVIEW_PATH}" >> $GITHUB_OUTPUT | |
| echo "PREVIEW_LINK=${PREVIEW_LINK}" >> $GITHUB_OUTPUT | |
| echo "PREVIEW_LINK_PATH=${PREVIEW_LINK_PATH}" >> $GITHUB_OUTPUT | |
| echo "PREVIEW_LINK_BASE=${PREVIEW_LINK_BASE}" >> $GITHUB_OUTPUT | |
| - name: Comment on PR | |
| continue-on-error: true | |
| run: | | |
| set -euo pipefail | |
| echo "Hey there, we noticed that this PR is now closed, so we'll remove the preview build now." >/tmp/comment | |
| gh pr comment ${{steps.details.outputs.PR_ID}} -F /tmp/comment | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Remove branch preview | |
| run: rm -rf ${{steps.details.outputs.PREVIEW_PATH}} | |
| - name: Commit changes | |
| run: | | |
| git add . | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Removing preview build for PR ${{steps.details.outputs.PR_ID}}" | |
| git push origin gh-pages | |
| else | |
| echo -e "No changes found." | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |