Skip to content

Instantly share code, notes, and snippets.

@larshp
Created October 12, 2023 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larshp/8e0a82c8a43d08f69cd49b8d807fbe83 to your computer and use it in GitHub Desktop.
Save larshp/8e0a82c8a43d08f69cd49b8d807fbe83 to your computer and use it in GitHub Desktop.
abapGit, user exit, encourage adding topics
METHOD zif_abapgit_exit~wall_message_repo.
DATA(lv_url) = is_repo_meta-url.
DATA(lo_agent) = zcl_abapgit_factory=>get_http_agent( ).
IF zcl_abapgit_login_manager=>get( lv_url ) IS NOT INITIAL.
lo_agent->global_headers( )->set(
iv_key = 'Authorization'
iv_val = zcl_abapgit_login_manager=>get( lv_url ) ).
ENDIF.
lv_url = replace(
val = is_repo_meta-url
sub = 'github.com'
with = 'api.github.com/repos' ).
lv_url = lv_url && '/topics'.
lo_agent->global_headers( )->set(
iv_key = 'Accept'
iv_val = 'application/vnd.github+json' ).
DATA(li_json) = lo_agent->request( lv_url )->json( ).
DATA(lt_topics) = li_json->array_to_string_table( '/names/' ).
READ TABLE lt_topics WITH KEY table_line = |sap-{ to_lower( sy-sysid ) }| TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
ii_html->add( |<div class="form-container">Please add topic "sap-{ to_lower( sy-sysid ) }" to the repository on github</div>| ).
ENDIF.
ENDMETHOD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment