Skip to content

ci: fix debounce on push to main #47

ci: fix debounce on push to main

ci: fix debounce on push to main #47

Workflow file for this run

name: Docs
on:
push:
paths: ['**/*.md', '**/docs.yml']
pull_request:
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
env:
REPO_NAME: ${{ github.event.repository.name }}
MOD_PATH: ~/.vmodules/vibe/
jobs:
debounce:
runs-on: ubuntu-latest
if: github.event.ref != 'refs/heads/debouce-fix' && github.event_name == 'push'
env:
GH_TOKEN: ${{ github.token }}
outputs:
abort: ${{ steps.debounce.outputs.abort }}
steps:
- name: Debounce
id: debounce
run: |
echo $GITHUB_REF_NAME
echo $GITHUB_EVENT_NAME
printenv
pr_branches=$(gh pr list --json headRefName --repo $GITHUB_REPOSITORY)
if [[ $(echo "$pr_branches" | jq -r --arg GITHUB_REF '.[].headRefName | select(. == $GITHUB_REF)') ]]; then
echo "This push is associated with a pull request. Skipping the job."
echo "abort=true" >> "$GITHUB_OUTPUT"
fi
check-docs:
needs: debounce
if: needs.debounce.outputs.abort != 'true'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Restore Cache
id: cache-status
uses: actions/cache/restore@v3
with:
path: |
vlang
~/.vmodules
key: ubuntu-latest${{ github.sha }}
- name: Setup V
uses: vlang/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Checkout ${{ env.REPO_NAME }}
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- name: Copy ${{ env.REPO_NAME }} to .vmodules
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }}
run: cp -r ${{ env.REPO_NAME }} ${{ env.MOD_PATH }}
- name: Check Markdown
run: v check-md -hide-warnings ${{ env.MOD_PATH }}
deploy:
if: github.ref_name == 'main' && github.event_name == 'push'
runs-on: ubuntu-latest
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install V
uses: vlang/[email protected]
with:
check-latest: true
- name: Checkout
uses: actions/checkout@v3
- name: Build docs
run: docs/build.vsh
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'docs/site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2