Skip to content

Commit d65b68a

Browse files
authored
fix(ci): use Create Issue From File (#1437)
Fixing: https://github.com/unionlabs/union/actions/runs/8032270299/job/21941488802 Sample issue: #1438
2 parents 25bca63 + f05f20d commit d65b68a

File tree

5 files changed

+49
-82
lines changed

5 files changed

+49
-82
lines changed

.github/workflows/check-links.yml

+17-60
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ name: Links Checker
33
on:
44
workflow_dispatch:
55
repository_dispatch:
6-
# fail fast
7-
push:
8-
branches:
9-
- main
10-
pull_request:
11-
branches:
12-
- main
136
# daily check
147
schedule:
158
- cron: '00 18 * * *'
@@ -22,46 +15,6 @@ env:
2215
ACTIONS_RUNNER_DEBUG: true
2316

2417
jobs:
25-
# runs on push and pull request
26-
link-checker:
27-
name: '🔗 Check Links'
28-
runs-on: ['ubuntu-latest']
29-
permissions:
30-
contents: read
31-
pull-requests: write
32-
if: github.event_name == 'push' || github.event_name == 'pull_request'
33-
steps:
34-
- uses: actions/checkout@v4
35-
with:
36-
lfs: true
37-
38-
- name: Link Check
39-
id: lychee
40-
uses: lycheeverse/[email protected]
41-
with:
42-
token: ${{ secrets.GITHUB_TOKEN }}
43-
args: |
44-
site/src app/src --config ${{ github.workspace }}/lychee.toml --github-token ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Comment On Pull Request
47-
uses: actions/github-script@v7
48-
# only comment if there are errors and it's a pull request
49-
if: env.lychee_exit_code != 0 && github.event_name == 'pull_request'
50-
# 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
51-
continue-on-error: true
52-
with:
53-
github-token: ${{ secrets.GITHUB_TOKEN }}
54-
script: |
55-
const fs = require('node:fs');
56-
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' });
57-
github.rest.issues.createComment({
58-
issue_number: context.issue.number,
59-
owner: context.repo.owner,
60-
repo: context.repo.repo,
61-
body: content
62-
});
63-
64-
# runs once daily
6518
daily-link-checker:
6619
name: '🔗 Check Links'
6720
runs-on: ['ubuntu-latest']
@@ -74,26 +27,30 @@ jobs:
7427
with:
7528
lfs: true
7629

30+
- name: Install Nix
31+
uses: cachix/install-nix-action@v25
32+
with:
33+
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }}
34+
github_access_token: ${{ github.token }}
35+
36+
- name: Build Site
37+
run: nix build .#site
38+
7739
- name: Link Check
7840
id: lychee
7941
uses: lycheeverse/[email protected]
8042
with:
8143
token: ${{ secrets.GITHUB_TOKEN }}
8244
args: |
83-
site/src app/src --config ${{ github.workspace }}/lychee.toml --github-token ${{ secrets.GITHUB_TOKEN }}
45+
--no-progress
46+
'result/**/index.html'
8447
8548
- name: Create Issue From File
86-
uses: actions/github-script@v7
8749
if: env.lychee_exit_code != 0
50+
uses: peter-evans/create-issue-from-file@v5
8851
with:
89-
github-token: ${{ secrets.GITHUB_TOKEN }}
90-
script: |
91-
const fs = require('node:fs');
92-
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' });
93-
github.issues.create({
94-
repo: context.repo.repo,
95-
owner: context.repo.owner,
96-
title: 'Link Checker Report',
97-
body: content,
98-
labels: ['report', 'automated issue']
99-
});
52+
title: Link Checker Report
53+
content-filepath: ./lychee/out.md
54+
labels: |
55+
documentation
56+
dead-links

.github/workflows/deploy-site.yml

+29-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ env:
2626
jobs:
2727
deploy-preview:
2828
runs-on: ['ubuntu-latest']
29-
permissions: write-all
29+
permissions:
30+
contents: read
31+
pull-requests: write
3032
env:
3133
npm_config_yes: true
3234
environment: 'site-preview'
@@ -55,6 +57,32 @@ jobs:
5557
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }}
5658
run: npx --yes wrangler@latest pages --project-name="site" deploy result >> /tmp/site_deploy.txt
5759

60+
- name: Link Check
61+
id: lychee
62+
uses: lycheeverse/[email protected]
63+
with:
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
args: |
66+
'result/**/index.html'
67+
68+
- name: Comment On Pull Request
69+
uses: actions/github-script@v7
70+
# only comment if there are errors and it's a pull request
71+
if: env.lychee_exit_code != 0
72+
# 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
73+
continue-on-error: true
74+
with:
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
script: |
77+
const fs = require('node:fs');
78+
const content = fs.readFileSync('./lychee/out.md', { encoding: 'utf8' });
79+
github.rest.issues.createComment({
80+
issue_number: context.issue.number,
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
body: content
84+
});
85+
5886
- name: Set Deploy Output
5987
run: |
6088
{

flake.nix

-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@
415415
jq
416416
go-ethereum
417417
marksman
418-
lychee
419418
nil
420419
nixfmt
421420
nix-tree

lychee.toml

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
1-
accept = [200, 429, 307]
1+
base = "result"
22
exclude = [
33
'^https://x.com/',
44
'.woff2$',
55
'^https://statesync.testnet.bonlulu.uno/',
66
'^https://grpc.testnet.bonlulu.uno/',
77
'^http://myserver.com:1111/',
8-
'^https://github.com/unionlabs/union/', # validated by astro
9-
# too stubborn of a page but we manually validated it
10-
'^https://math.mit.edu/research/highschool/primes/materials/2018/Kuszmaul.pdf',
11-
'^CHANGELOG.md$',
12-
'^**/node_modules$',
13-
'^node_modules$',
148
]
9+
1510
exclude_all_private = true
16-
exclude_path = [
17-
"result",
18-
"node_modules",
19-
"build",
20-
"dist",
21-
"target",
22-
"**/node_modules",
23-
"**/build",
24-
"**/dist",
25-
"**/target",
26-
]
27-
timeout = 20

site/src/content/docs/docs/joining-testnet/getting-tokens.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Take note of your `address` here and continue to [Receiving Testnet Tokens](#rec
5050

5151
## Receiving Testnet Tokens
5252

53-
Those interested can submit their Union address to the Subo Survey Bot on [our Discord](https://discord.gg/union-build) to have a chance of being selected as a validator and receiving tokens from the Union team.
53+
Those interested can submit their Union address to the Subo Survey Bot on [our Discord](https://discord.union.build) to have a chance of being selected as a validator and receiving tokens from the Union team.
5454

5555
:::note
5656

0 commit comments

Comments
 (0)