Skip to content

Conversation

@TC-MO
Copy link
Contributor

@TC-MO TC-MO commented Aug 7, 2024

Given the amount of false positives we run into at every time when we are adding a new page to docs, it makes sense to change the link checking job to periodic instead of at every PR.

@TC-MO TC-MO self-assigned this Aug 7, 2024
@github-actions github-actions bot added the t-docs Issues owned by technical writing team. label Aug 7, 2024
@TC-MO TC-MO changed the title rework lychee action so it works periodically instead of at every PR feat: change link checking to periodic Aug 7, 2024
@TC-MO TC-MO requested a review from B4nan August 7, 2024 10:09
Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets revert the whitespace changes unless the other workflows use 2 spaces for indents

@TC-MO TC-MO requested a review from B4nan August 7, 2024 10:42
continue-on-error: true

- name: Add job summary
if: always()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats the point of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that this creates job summary that can be later found within Actions UI based on the .md file created during the run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean what is the point of using if: always()? removing that line should have the same effect unless i am missing something :]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah fair enough, this was supposed to make sure job summary gets created even if previous steps fail, but not sure if this is correct way to do it and if you think it should be removed , let's remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see, never saw it before. i dont mind keeping it there if it actually does something, up to you really, maybe keep it and remove once you see its not adding value for the broke builds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense to me

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert those whitespace changes too, the indent should be 4 spaces, not 4 and sometimes 2 at the end...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk how you format this, webstorm handles this correctly out of box, here is the full formatted file:

name: Periodic Link Checker

on:
    schedule:
        -   cron: '0 0 * * *'  # Run daily at midnight UTC
    workflow_dispatch:  # Allow manual triggering

jobs:
    link-check:
        runs-on: ubuntu-latest
        steps:
            -   uses: actions/checkout@v4

            -   name: Use Node.js 20
                uses: actions/setup-node@v4
                with:
                    node-version: 20
                    cache: 'npm'
                    cache-dependency-path: 'package-lock.json'
                    always-auth: 'true'
                    registry-url: 'https://npm.pkg.github.com/'
                    scope: '@apify-packages'

            -   name: Build docs
                run: |
                    npm ci --force
                    npm update @apify/openapi
                    npm run build
                env:
                    APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }}
                    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
                    SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }}

            -   name: Run Lychee Link Checker
                id: lychee
                uses: lycheeverse/lychee-action@v1.10.0
                env:
                    GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
                with:
                    fail: false
                    args: >
                        --base https://docs.apify.com
                        --exclude-path 'build/versions.html'
                        --max-retries 6
                        --verbose
                        --no-progress
                        --accept '100..=103,200..=299,403..=403,429'
                        --output ./lychee/out.md
                        --format markdown
                        './build/**/*.html'
                continue-on-error: true

            -   name: Add job summary
                if: always()
                run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk how you format this, webstorm handles this correctly out of box, here is the full formatted file:

name: Periodic Link Checker

on:
    schedule:
        -   cron: '0 0 * * *'  # Run daily at midnight UTC
    workflow_dispatch:  # Allow manual triggering

jobs:
    link-check:
        runs-on: ubuntu-latest
        steps:
            -   uses: actions/checkout@v4

            -   name: Use Node.js 20
                uses: actions/setup-node@v4
                with:
                    node-version: 20
                    cache: 'npm'
                    cache-dependency-path: 'package-lock.json'
                    always-auth: 'true'
                    registry-url: 'https://npm.pkg.github.com/'
                    scope: '@apify-packages'

            -   name: Build docs
                run: |
                    npm ci --force
                    npm update @apify/openapi
                    npm run build
                env:
                    APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }}
                    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
                    SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }}

            -   name: Run Lychee Link Checker
                id: lychee
                uses: lycheeverse/lychee-action@v1.10.0
                env:
                    GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
                with:
                    fail: false
                    args: >
                        --base https://docs.apify.com
                        --exclude-path 'build/versions.html'
                        --max-retries 6
                        --verbose
                        --no-progress
                        --accept '100..=103,200..=299,403..=403,429'
                        --output ./lychee/out.md
                        --format markdown
                        './build/**/*.html'
                continue-on-error: true

            -   name: Add job summary
                if: always()
                run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY

@TC-MO
Copy link
Contributor Author

TC-MO commented Aug 7, 2024

Thank you, not sure what is the issue with VSC and formatting ¯_(ツ)_/¯

@TC-MO
Copy link
Contributor Author

TC-MO commented Aug 8, 2024

@B4nan are any other changes needed or can we move forward with merging thit change?

@B4nan B4nan merged commit 1730e55 into master Aug 8, 2024
@B4nan B4nan deleted the periodic-link-checking branch August 8, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-docs Issues owned by technical writing team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants