Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdyscout committed Dec 17, 2022
1 parent c9cfaf5 commit bb2d5ce
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 176 deletions.
64 changes: 33 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,44 @@ on:
release:
types: [published]

env:
REPOSITORY_NAME: ${{ github.event.repository.name }}

jobs:
certificate:
runs-on: ubuntu-latest
name: certificate OSHWA project
steps:
- uses: actions/checkout@v3
- uses: nerdyscout/oshwa-action@main
with:
token: ${{ secrets.OSHWA_TOKEN }}
responsiblePartyType: "Individual"
responsibleParty: $GITHUB_REPOSITORY_OWNER
bindingParty: ""
country: ""
projectName: ${GITHUB_REPOSITORY#*/}
projectWebsite: "https://" $GITHUB_REPOSITORY_OWNER "github.io/" ${GITHUB_REPOSITORY#*/}
projectVersion: $GITHUB_REF_NAME
# previousVersions: ["US000000","US000001"]
projectDescription: ""
primaryType: "Electronics"
documentationUrl: "https://github.com/" $GITHUB_REPOSITORY "/docs"
hardwareLicense: "CERN"
softwareLicense: "GPL"
documentationLicense: "CC BY"
noCommercialRestriction: true
noDocumentationRestriction: true
openHardwareComponents: true
creatorContribution: true
noUseRestriction: true
redistributedWork: true
noSpecificProduct: true
noComponentRestriction: true
technologyNeutral: true
CertificationMarkTerms: {'accurateContactInformation':{},'complianceWithOfficialCertificationGuidelines': {},'oshwaCertificationMark': {},'violationsEnforcement': {},'responsibility': {'term': 'I have the ability to bind those responsible for the certified item to this agreement.','agreement': true}}
relationship: "self"
agreementTerms: true
parentName: $GITHUB_REPOSITORY_OWNER
- uses: nerdyscout/oshwa-action@main
with:
token: ${{ secrets.OSHWA_TOKEN }}
responsiblePartyType: "Individual"
responsibleParty: ${{ github.repository_owner }}
bindingParty: ""
country: ""
projectName: ${{ env.REPOSITORY_NAME }}
projectWebsite: "https://${{ github.repository_owner }}.github.io/${{ env.REPOSITORY_NAME }}"
projectVersion: ${{ github.ref_name }}
# previousVersions: ["US000000","US000001"]
projectDescription: ""
primaryType: "Electronics"
documentationUrl: "https://github.com/${{ github.repository }}/docs"
hardwareLicense: "CERN"
softwareLicense: "GPL"
documentationLicense: "CC BY"
noCommercialRestriction: true
noDocumentationRestriction: true
openHardwareComponents: true
creatorContribution: true
noUseRestriction: true
redistributedWork: true
noSpecificProduct: true
noComponentRestriction: true
technologyNeutral: true
CertificationMarkTerms: {'accurateContactInformation':{},'complianceWithOfficialCertificationGuidelines': {},'oshwaCertificationMark': {},'violationsEnforcement': {},'responsibility': {'term': 'I have the ability to bind those responsible for the certified item to this agreement.','agreement': true}}
relationship: "self"
agreementTerms: true
parentName: ${{ github.repository_owner }}
```
## Inputs
Expand Down
139 changes: 69 additions & 70 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6849,21 +6849,21 @@ module.exports = webrequest;

const webrequest = __nccwpck_require__(88)

function post_project(url, token, payload) {
async function post_project(url, token, payload) {
const auth = { 'Authorization': 'Bearer ' + token };
return response = webrequest(url + 'projects/', 'post', payload, auth);
return await webrequest(url + 'projects/', 'post', payload, auth);
}
module.exports.post_project = post_project;

function get_project(url, token, id) {
async function get_project(url, token, id) {
const auth = { 'Authorization': 'Bearer ' + token };
return response = webrequest(url + 'projects/' + id, 'get', '', auth);
return await webrequest(url + 'projects/' + id, 'get', '', auth);
}
module.exports.get_project = get_project;

function get_options(url, token) {
async function get_options(url, token) {
const auth = { 'Authorization': 'Bearer ' + token };
return response = webrequest(url + 'options/', 'get', '', auth);
return await webrequest(url + 'options/', 'get', '', auth);
}
module.exports.get_options = get_options;

Expand Down Expand Up @@ -7043,78 +7043,77 @@ const core = __nccwpck_require__(2810);
const oshwa = __nccwpck_require__(5741);

async function main() {
try {
// consts
const token = core.getInput('token');
const url = core.getInput('url')
// inputs from action
var payload = {
"responsiblePartyType": core.getInput('responsiblePartyType'),
"responsibleParty": core.getInput('responsibleParty'),
"bindingParty": core.getInput('bindingParty'),
"country": core.getInput('country'),
"streetAddress1": core.getInput('streetAddress1'),
"streetAddress2": core.getInput('streetAddress2'),
"city": core.getInput('city'),
"state": core.getInput('state'),
"postalCode": core.getInput('postalCode'),
"privateContact": core.getInput('privateContact'),
"publicContact": core.getInput('publicContact'),
"projectName": core.getInput('projectName'),
"projectWebsite": core.getInput('projectWebsite'),
"projectVersion": core.getInput('projectVersion'),
"previousVersions": core.getInput('previousVersions'),
"projectDescription": core.getInput('projectDescription'),
"primaryType": core.getInput('primaryType'),
"additionalType": core.getInput('additionalType'),
"projectKeywords": core.getInput('projectKeywords'),
"citations": core.getInput('citation'),
"documentationUrl": core.getInput('documentationUrl'),
"availableFileFormat": core.getInput('availableFileFormat'),
"hardwareLicense": core.getInput('hardwareLicense'),
"softwareLicense": core.getInput('softwareLicense'),
"documentationLicense": core.getInput('documentationLicense'),
"noCommercialRestriction": core.getInput('noCommercialRestriction'),
"explanationNcr": core.getInput('explanationNcr'),
"noDocumentationRestriction": core.getInput('noDocumentationRestriction'),
"explanationNdr": core.getInput('explanationNdr'),
"openHardwareComponents": core.getInput('openHardwareComponents'),
"explanationOhwc": core.getInput('explanationOhwc'),
"creatorContribution": core.getInput('creatorContribution'),
"explanationCcr": core.getInput('explanationCcr'),
"noUseRestriction": core.getInput('noUseRestriction'),
"explanationNur": core.getInput('explanationNur'),
"redistributedWork": core.getInput('redistributedWork'),
"explanationRwr": core.getInput('explanationRwr'),
"noSpecificProduct": core.getInput('noSpecificProduct'),
"explanationNsp": core.getInput('explanationNsp'),
"noComponentRestriction": core.getInput('noComponentRestriction'),
"explanationNor": core.getInput('explanationNor'),
"technologyNeutral": core.getInput('technologyNeutral'),
"explanationTn": core.getInput('explanationTn'),
"certificationMarkTerms": {
"accurateContactInformation": {
"term": "I have provided OSHWA with accurate contact information, recognize that all official communications from OSHWA will be directed to that contact information, and will update that contact information as necessary.",
"agreement": true
}
},
"explanationCertificationTerms": core.getInput('explanationCertificationTerms'),
"relationship": core.getInput('relationship'),
"agreementTerms": core.getInput('agreementTerms'),
"parentName": core.getInput('parentName')
};

// http request to external API
const response = await oshwa.post_project(url, token, JSON.stringify(payload, undefined, 2));
// consts
const token = core.getInput('token');
const url = core.getInput('url');
// inputs from action
const payload = {
responsiblePartyType: core.getInput('responsiblePartyType'),
responsibleParty: core.getInput('responsibleParty'),
bindingParty: core.getInput('bindingParty'),
country: core.getInput('country'),
streetAddress1: core.getInput('streetAddress1'),
streetAddress2: core.getInput('streetAddress2'),
city: core.getInput('city'),
state: core.getInput('state'),
postalCode: core.getInput('postalCode'),
privateContact: core.getInput('privateContact'),
publicContact: core.getInput('publicContact'),
projectName: core.getInput('projectName'),
projectWebsite: core.getInput('projectWebsite'),
projectVersion: core.getInput('projectVersion'),
previousVersions: core.getInput('previousVersions'),
projectDescription: core.getInput('projectDescription'),
primaryType: core.getInput('primaryType'),
additionalType: core.getInput('additionalType'),
projectKeywords: core.getInput('projectKeywords'),
citations: core.getInput('citation'),
documentationUrl: core.getInput('documentationUrl'),
availableFileFormat: core.getInput('availableFileFormat'),
hardwareLicense: core.getInput('hardwareLicense'),
softwareLicense: core.getInput('softwareLicense'),
documentationLicense: core.getInput('documentationLicense'),
noCommercialRestriction: core.getInput('noCommercialRestriction'),
explanationNcr: core.getInput('explanationNcr'),
noDocumentationRestriction: core.getInput('noDocumentationRestriction'),
explanationNdr: core.getInput('explanationNdr'),
openHardwareComponents: core.getInput('openHardwareComponents'),
explanationOhwc: core.getInput('explanationOhwc'),
creatorContribution: core.getInput('creatorContribution'),
explanationCcr: core.getInput('explanationCcr'),
noUseRestriction: core.getInput('noUseRestriction'),
explanationNur: core.getInput('explanationNur'),
redistributedWork: core.getInput('redistributedWork'),
explanationRwr: core.getInput('explanationRwr'),
noSpecificProduct: core.getInput('noSpecificProduct'),
explanationNsp: core.getInput('explanationNsp'),
noComponentRestriction: core.getInput('noComponentRestriction'),
explanationNor: core.getInput('explanationNor'),
technologyNeutral: core.getInput('technologyNeutral'),
explanationTn: core.getInput('explanationTn'),
certificationMarkTerms: {
accurateContactInformation: {
term: "I have provided OSHWA with accurate contact information, recognize that all official communications from OSHWA will be directed to that contact information, and will update that contact information as necessary.",
agreement: true
}
},
explanationCertificationTerms: core.getInput('explanationCertificationTerms'),
relationship: core.getInput('relationship'),
agreementTerms: core.getInput('agreementTerms'),
parentName: core.getInput('parentName')
};

try {
const response = await oshwa.post_project(url, token, JSON.stringify(payload));
console.log(response);

if (response.status >= 400) {
core.setFailed(`HTTP request failed with status code: ${response.res.statusCode}`);
core.setFailed(`HTTP request failed with status code: ${response.status}`);
} else {
core.setOutput('response', response.res);
}
} catch (error) {
console.log(error);
core.setFailed(error.message);
}
}
Expand Down
Loading

0 comments on commit bb2d5ce

Please sign in to comment.