You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/repos/Client.swift
+213Lines changed: 213 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1659,6 +1659,219 @@ public struct Client: APIProtocol {
1659
1659
}
1660
1660
)
1661
1661
}
1662
+
/// Create an attestation
1663
+
///
1664
+
/// Store an artifact attestation and associate it with a repository.
1665
+
///
1666
+
/// The authenticated user must have write permission to the repository and, if using a fine-grained access token the `attestations:write` permission is required.
1667
+
///
1668
+
/// Artifact attestations are meant to be created using the [attest action](https://github.com/actions/attest). For amore information, see our guide on [using artifact attestations to establish a build's provenance](https://docs.github.com/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
preconditionFailure("bestContentType chose an invalid content type.")
1726
+
}
1727
+
return .created(.init(body: body))
1728
+
case 403:
1729
+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1730
+
let body: Components.Responses.forbidden.Body
1731
+
let chosenContentType = try converter.bestContentType(
1732
+
received: contentType,
1733
+
options: [
1734
+
"application/json"
1735
+
]
1736
+
)
1737
+
switch chosenContentType {
1738
+
case "application/json":
1739
+
body = try await converter.getResponseBodyAsJSON(
1740
+
Components.Schemas.basic_hyphen_error.self,
1741
+
from: responseBody,
1742
+
transforming: { value in
1743
+
.json(value)
1744
+
}
1745
+
)
1746
+
default:
1747
+
preconditionFailure("bestContentType chose an invalid content type.")
1748
+
}
1749
+
return .forbidden(.init(body: body))
1750
+
case 422:
1751
+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1752
+
let body: Components.Responses.validation_failed.Body
1753
+
let chosenContentType = try converter.bestContentType(
1754
+
received: contentType,
1755
+
options: [
1756
+
"application/json"
1757
+
]
1758
+
)
1759
+
switch chosenContentType {
1760
+
case "application/json":
1761
+
body = try await converter.getResponseBodyAsJSON(
1762
+
Components.Schemas.validation_hyphen_error.self,
1763
+
from: responseBody,
1764
+
transforming: { value in
1765
+
.json(value)
1766
+
}
1767
+
)
1768
+
default:
1769
+
preconditionFailure("bestContentType chose an invalid content type.")
1770
+
}
1771
+
return .unprocessableContent(.init(body: body))
1772
+
default:
1773
+
return .undocumented(
1774
+
statusCode: response.status.code,
1775
+
.init(
1776
+
headerFields: response.headerFields,
1777
+
body: responseBody
1778
+
)
1779
+
)
1780
+
}
1781
+
}
1782
+
)
1783
+
}
1784
+
/// List attestations
1785
+
///
1786
+
/// List a collection of artifact attestations with a given subject digest that are associated with a repository.
1787
+
///
1788
+
/// The authenticated user making the request must have read access to the repository. In addition, when using a fine-grained access token the `attestations:read` permission is required.
1789
+
///
1790
+
/// **Please note:** in order to offer meaningful security benefits, an attestation's signature and timestamps **must** be cryptographically verified, and the identity of the attestation signer **must** be validated. Attestations can be verified using the [GitHub CLI `attestation verify` command](https://cli.github.com/manual/gh_attestation_verify). For more information, see [our guide on how to use artifact attestations to establish a build's provenance](https://docs.github.com/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
0 commit comments