The NoScript FAQ answers this very question, using ABE (Application Boundaries Enforcer):
Site .akamai.net
Accept INCLUSION from SELF++
Accept INCLUSION from .trusted-site1.com .trusted-site2.com trusted-site3.com
Deny
So:
Site .akamai.net
Accept INCLUSION from SELF++
Accept INCLUSION from *.github.com github.com
Deny
...should work?
More info on ABE here, including a PDF of the how to write the rules.
See also from Informaction.com forums:
Notice that since ABE's rule work independently from NoScript's permissions, you need to "Allow google-analytics.com" in NoScript's menu for the above to work.
Notice also that, independently from ABE, even if a certain script source is whitelisted in NoScript it won't run as a 3rd party script on pages whose origin is not whitelisted itself.
Note that as of the "new" NoScript that has to be used in Firefox 57+, ABE's are no longer available. – CR. – 2018-02-24T13:10:45.873