- 
                Notifications
    
You must be signed in to change notification settings  - Fork 71
 
Taylor/update url checker #994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            Telucero
  wants to merge
  20
  commits into
  master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
taylor/update-url-checker
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +69
        
        
          −27
        
        
          
        
      
    
  
  
     Open
                    Changes from 13 commits
      Commits
    
    
            Show all changes
          
          
            20 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      4176cb3
              
                update
              
              
                Telucero b1b4188
              
                remove
              
              
                Telucero 5084010
              
                test
              
              
                Telucero a185e32
              
                test
              
              
                Telucero 87ebe09
              
                json test
              
              
                Telucero 41303b5
              
                revet files
              
              
                Telucero 80005a5
              
                script revision
              
              
                Telucero aae8f06
              
                .nav check
              
              
                Telucero 61758dd
              
                fix nav issue
              
              
                Telucero c9c6976
              
                nav check
              
              
                Telucero 9fff211
              
                update paths
              
              
                Telucero 54a25cc
              
                 update with nav fix
              
              
                Telucero e753ab3
              
                 revert nav changes
              
              
                Telucero 1bee80d
              
                Update .github/workflows/check-url-changes.yml
              
              
                Telucero e3f072a
              
                reverted and updated
              
              
                Telucero 24a586a
              
                Merge remote-tracking branch 'origin/master' into taylor/update-url-c…
              
              
                Telucero 92a5e9d
              
                rename test
              
              
                Telucero 74bc8c7
              
                revert
              
              
                Telucero bb50a32
              
                apply feedback
              
              
                Telucero e36e9bf
              
                apply to base branch
              
              
                Telucero File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,72 +1,72 @@ | ||
| name: Check Documentation URL Changes | ||
| 
     | 
||
| name: Documentation & Navigation Change Checker | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| 
     | 
||
| jobs: | ||
| check-url-changes: | ||
| check-doc-nav-changes: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| - name: Checkout PR branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| 
     | 
||
| - name: Identify deleted and renamed files | ||
| fetch-depth: 1 | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| - name: Fetch base branch | ||
| run: git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 | ||
| - name: Identify .md and .nav changes | ||
| run: | | ||
| # Store deleted files | ||
| DELETED_FILES=$(git diff --name-status origin/master ${{ github.event.pull_request.head.sha }} | grep '^D.*\.md$' | cut -f2- || true) | ||
| echo "DELETED_FILES<<EOF" >> $GITHUB_ENV | ||
| echo "$DELETED_FILES" >> $GITHUB_ENV | ||
| echo "EOF" >> $GITHUB_ENV | ||
| BASE=origin/${{ github.event.pull_request.base.ref }} | ||
| HEAD=${{ github.event.pull_request.head.sha }} | ||
| 
     | 
||
| # Store renamed/moved files | ||
| RENAMED_FILES=$(git diff --name-status origin/master ${{ github.event.pull_request.head.sha }} | grep '^R.*\.md$' | awk '{print $2 " -> " $3}' || true) | ||
| echo "RENAMED_FILES<<EOF" >> $GITHUB_ENV | ||
| echo "$RENAMED_FILES" >> $GITHUB_ENV | ||
| echo "EOF" >> $GITHUB_ENV | ||
| # Markdown changes | ||
| DELETED_MD=$(git diff --name-status $BASE $HEAD | grep '^D.*\.md$' | cut -f2- || true) | ||
| RENAMED_MD=$(git diff --name-status $BASE $HEAD | grep '^R.*\.md$' | awk '{print $2 " -> " $3}' || true) | ||
| 
     | 
||
| # Nav changes | ||
| DELETED_NAV=$(git diff --name-status $BASE $HEAD | grep '^D.*\.nav\.ya?ml$' | cut -f2- || true) | ||
| MODIFIED_NAV=$(git diff --name-status $BASE $HEAD | grep -E '^[AM].*\.nav\.ya?ml$' | cut -f2- || true) | ||
| RENAMED_NAV=$(git diff --name-status $BASE $HEAD | grep '^R.*\.nav\.ya?ml$' | awk '{print $2 " -> " $3}' || true) | ||
| 
     | 
||
| # Set warning flag if there are any changes | ||
| if [ ! -z "$DELETED_FILES" ] || [ ! -z "$RENAMED_FILES" ]; then | ||
| NAV_CHANGES="" | ||
| for f in $DELETED_NAV; do NAV_CHANGES+="$f: [DELETED]\n\n"; done | ||
| for f in $MODIFIED_NAV; do DIFF=$(git diff $BASE $HEAD -- "$f" | grep -vE '^\+\+\+|^---'); NAV_CHANGES+="$f:\n$DIFF\n\n"; done | ||
| for f in $RENAMED_NAV; do NAV_CHANGES+="$f [RENAMED]\n\n"; done | ||
| echo "DELETED_MD<<EOF" >> $GITHUB_ENV | ||
| echo "$DELETED_MD" >> $GITHUB_ENV | ||
| echo "EOF" >> $GITHUB_ENV | ||
| echo "RENAMED_MD<<EOF" >> $GITHUB_ENV | ||
| echo "$RENAMED_MD" >> $GITHUB_ENV | ||
| echo "EOF" >> $GITHUB_ENV | ||
| echo "NAV_CHANGES<<EOF" >> $GITHUB_ENV | ||
| echo -e "$NAV_CHANGES" >> $GITHUB_ENV | ||
| echo "EOF" >> $GITHUB_ENV | ||
| if [ -n "$DELETED_MD$RENAMED_MD$NAV_CHANGES" ]; then | ||
| echo "warning=true" >> $GITHUB_ENV | ||
| else | ||
| echo "warning=false" >> $GITHUB_ENV | ||
| fi | ||
| 
     | 
||
| # Print to console for logging | ||
| echo "Deleted files:" | ||
| echo "$DELETED_FILES" | ||
| echo -e "\nRenamed/Moved files:" | ||
| echo "$RENAMED_FILES" | ||
| 
     | 
||
| - name: Post PR warning | ||
| - name: Post PR comment if relevant | ||
| if: env.warning == 'true' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const issue_number = context.payload.pull_request.number; | ||
| const repo = context.repo; | ||
| const deletedFiles = `${process.env.DELETED_FILES}`.trim(); | ||
| const renamedFiles = `${process.env.RENAMED_FILES}`.trim(); | ||
| 
     | 
||
| let message = `🔍 **Documentation URL Checker**\n\nThis PR modifies documentation files in ways that could potentially create broken links.\n\n`; | ||
| 
     | 
||
| if (deletedFiles) { | ||
| message += `**Deleted files:**\n\`\`\`\n${deletedFiles}\n\`\`\`\n\n`; | ||
| } | ||
| 
     | 
||
| if (renamedFiles) { | ||
| message += `**Renamed/Moved files:**\n\`\`\`\n${renamedFiles}\n\`\`\`\n\n`; | ||
| } | ||
| 
     | 
||
| message += `🚨 Please review these changes carefully 🚨\n\n If not handled properly, broken links (404 errors) could appear. To maintain a smooth user experience, consider:\n- Adding redirects in the \`mkdocs.yml\` file from the old URLs to the new ones\n- Updating internal references to these files`; | ||
| const deletedMd = `${process.env.DELETED_MD}`.trim(); | ||
| const renamedMd = `${process.env.RENAMED_MD}`.trim(); | ||
| const navChanges = `${process.env.NAV_CHANGES}`.trim(); | ||
| 
     | 
||
| let message = "🔍 **Documentation & Navigation Checker**\n\nThis PR modifies `.md` or `.nav.yml/.nav.yaml` files.\n\n"; | ||
| if (deletedMd) message += `**Deleted Markdown files:**\n\`\`\`\n${deletedMd}\n\`\`\`\n\n`; | ||
| if (renamedMd) message += `**Renamed Markdown files:**\n\`\`\`\n${renamedMd}\n\`\`\`\n\n`; | ||
| if (navChanges) message += `**Navigation file changes:**\n\`\`\`\n${navChanges}\n\`\`\`\n\n`; | ||
| 
     | 
||
| message += "🚨 Please verify:\n- Links are correct\n- TOC matches expected structure\n- Deleted/renamed entries are handled. \n\n 🚨 If not handled properly, broken links (404 errors) could appear. To maintain a smooth user experience, consider:\n- Adding redirects in the \`mkdocs.yml\` file from the old URLs to the new ones\n- Updating internal references to these files"; | ||
                
      
                  Telucero marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| github.rest.issues.createComment({ | ||
| owner: repo.owner, | ||
| repo: repo.repo, | ||
| issue_number: issue_number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.pull_request.number, | ||
| body: message | ||
| }); | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.