@@ -11,22 +11,24 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
11
11
} ;
12
12
13
13
let repo = e. issue . repository ( ) ;
14
- if !( repo. organization == "rust-lang" && repo. repository == "rfcs" ) {
15
- return Ok ( ( ) ) ;
16
- }
14
+ let prefix = match ( & * repo. organization , & * repo. repository ) {
15
+ ( "rust-lang" , "rfcs" ) => "text/" ,
16
+ ( "rust-lang" , "blog.rust-lang.org" ) => "posts/" ,
17
+ _ => return Ok ( ( ) ) ,
18
+ } ;
17
19
18
- if let Err ( e) = add_rendered_link ( & ctx, & e) . await {
20
+ if let Err ( e) = add_rendered_link ( & ctx, & e, prefix ) . await {
19
21
tracing:: error!( "Error adding rendered link: {:?}" , e) ;
20
22
}
21
23
22
24
Ok ( ( ) )
23
25
}
24
26
25
- async fn add_rendered_link ( ctx : & Context , e : & IssuesEvent ) -> anyhow:: Result < ( ) > {
27
+ async fn add_rendered_link ( ctx : & Context , e : & IssuesEvent , prefix : & str ) -> anyhow:: Result < ( ) > {
26
28
if e. action == IssuesAction :: Opened {
27
29
let files = e. issue . files ( & ctx. github ) . await ?;
28
30
29
- if let Some ( file) = files. iter ( ) . find ( |f| f. filename . starts_with ( "text/" ) ) {
31
+ if let Some ( file) = files. iter ( ) . find ( |f| f. filename . starts_with ( prefix ) ) {
30
32
if !e. issue . body . contains ( "[Rendered]" ) {
31
33
// This URL should be stable while the PR is open, even if the
32
34
// user pushes new commits.
0 commit comments