-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): use Create Issue From File (#1437)
Fixing: https://github.com/unionlabs/union/actions/runs/8032270299/job/21941488802 Sample issue: #1438
- Loading branch information
Showing
5 changed files
with
49 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -3,13 +3,6 @@ name: Links Checker | |
on: | ||
workflow_dispatch: | ||
repository_dispatch: | ||
# fail fast | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
# daily check | ||
schedule: | ||
- cron: '00 18 * * *' | ||
|
@@ -22,46 +15,6 @@ env: | |
ACTIONS_RUNNER_DEBUG: true | ||
|
||
jobs: | ||
# runs on push and pull request | ||
link-checker: | ||
name: '🔗 Check Links' | ||
runs-on: ['ubuntu-latest'] | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
if: github.event_name == 'push' || github.event_name == 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
|
||
- name: Link Check | ||
id: lychee | ||
uses: lycheeverse/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: | | ||
site/src app/src --config ${{ github.workspace }}/lychee.toml --github-token ${{ secrets.GITHUB_TOKEN }} | ||
- name: Comment On Pull Request | ||
uses: actions/github-script@v7 | ||
# only comment if there are errors and it's a pull request | ||
if: env.lychee_exit_code != 0 && github.event_name == 'pull_request' | ||
# temporarily allow this to fail until we're able to handle these two links: https://github.com/unionlabs/union/actions/runs/8014925873/attempts/1#summary-21894317581 | ||
continue-on-error: true | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('node:fs'); | ||
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' }); | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: content | ||
}); | ||
# runs once daily | ||
daily-link-checker: | ||
name: '🔗 Check Links' | ||
runs-on: ['ubuntu-latest'] | ||
|
@@ -74,26 +27,30 @@ jobs: | |
with: | ||
lfs: true | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v25 | ||
with: | ||
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }} | ||
github_access_token: ${{ github.token }} | ||
|
||
- name: Build Site | ||
run: nix build .#site | ||
|
||
- name: Link Check | ||
id: lychee | ||
uses: lycheeverse/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: | | ||
site/src app/src --config ${{ github.workspace }}/lychee.toml --github-token ${{ secrets.GITHUB_TOKEN }} | ||
--no-progress | ||
'result/**/index.html' | ||
- name: Create Issue From File | ||
uses: actions/github-script@v7 | ||
if: env.lychee_exit_code != 0 | ||
uses: peter-evans/create-issue-from-file@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('node:fs'); | ||
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' }); | ||
github.issues.create({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
title: 'Link Checker Report', | ||
body: content, | ||
labels: ['report', 'automated issue'] | ||
}); | ||
title: Link Checker Report | ||
content-filepath: ./lychee/out.md | ||
labels: | | ||
documentation | ||
dead-links |
This file contains 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 |
---|---|---|
|
@@ -26,7 +26,9 @@ env: | |
jobs: | ||
deploy-preview: | ||
runs-on: ['ubuntu-latest'] | ||
permissions: write-all | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
env: | ||
npm_config_yes: true | ||
environment: 'site-preview' | ||
|
@@ -55,6 +57,32 @@ jobs: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }} | ||
run: npx --yes wrangler@latest pages --project-name="site" deploy result >> /tmp/site_deploy.txt | ||
|
||
- name: Link Check | ||
id: lychee | ||
uses: lycheeverse/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: | | ||
'result/**/index.html' | ||
- name: Comment On Pull Request | ||
uses: actions/github-script@v7 | ||
# only comment if there are errors and it's a pull request | ||
if: env.lychee_exit_code != 0 | ||
# temporarily allow this to fail until we're able to handle these two links: https://github.com/unionlabs/union/actions/runs/8014925873/attempts/1#summary-21894317581 | ||
continue-on-error: true | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('node:fs'); | ||
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' }); | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: content | ||
}); | ||
- name: Set Deploy Output | ||
run: | | ||
{ | ||
|
This file contains 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 |
---|---|---|
|
@@ -415,7 +415,6 @@ | |
jq | ||
go-ethereum | ||
marksman | ||
lychee | ||
nil | ||
nixfmt | ||
nix-tree | ||
|
This file contains 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,27 +1,10 @@ | ||
accept = [200, 429, 307] | ||
base = "result" | ||
exclude = [ | ||
'^https://x.com/', | ||
'.woff2$', | ||
'^https://statesync.testnet.bonlulu.uno/', | ||
'^https://grpc.testnet.bonlulu.uno/', | ||
'^http://myserver.com:1111/', | ||
'^https://github.com/unionlabs/union/', # validated by astro | ||
# too stubborn of a page but we manually validated it | ||
'^https://math.mit.edu/research/highschool/primes/materials/2018/Kuszmaul.pdf', | ||
'^CHANGELOG.md$', | ||
'^**/node_modules$', | ||
'^node_modules$', | ||
] | ||
|
||
exclude_all_private = true | ||
exclude_path = [ | ||
"result", | ||
"node_modules", | ||
"build", | ||
"dist", | ||
"target", | ||
"**/node_modules", | ||
"**/build", | ||
"**/dist", | ||
"**/target", | ||
] | ||
timeout = 20 |
This file contains 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