@@ -11,22 +11,24 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
1111 } ;
1212
1313 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+ } ;
1719
18- if let Err ( e) = add_rendered_link ( & ctx, & e) . await {
20+ if let Err ( e) = add_rendered_link ( & ctx, & e, prefix ) . await {
1921 tracing:: error!( "Error adding rendered link: {:?}" , e) ;
2022 }
2123
2224 Ok ( ( ) )
2325}
2426
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 < ( ) > {
2628 if e. action == IssuesAction :: Opened {
2729 let files = e. issue . files ( & ctx. github ) . await ?;
2830
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 ) ) {
3032 if !e. issue . body . contains ( "[Rendered]" ) {
3133 // This URL should be stable while the PR is open, even if the
3234 // user pushes new commits.
0 commit comments