Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
  • Loading branch information
wangxiaoxuan273 committed Jun 5, 2024
1 parent ecdebb4 commit 23e5458
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ jobs:
steps:
- id: checkout
uses: actions/checkout@v3
- id: get-url
run: echo "URL=$(jq -r 'keys_unsorted[0] as $k | .[$k].linux.amd64.url' src/lib/data/releases.json)" >> "$GITHUB_OUTPUT"
- id: get-checksum
run: echo "CHECKSUM=$(jq -r 'keys_unsorted[0] as $k | .[$k].linux.amd64.checksum' src/lib/data/releases.json)" >> "$GITHUB_OUTPUT"
- id: get-checksum-url
run: |
RELEASE=$(jq -r 'keys_unsorted[0] as $k | .[$k].linux.amd64' src/lib/data/releases.json)
echo "CHECKSUM=$(echo $RELEASE | jq -r '.checksum')" >> "$GITHUB_OUTPUT"
echo "URL=$(echo $RELEASE | jq -r '.url')" >> "$GITHUB_OUTPUT"

test-custom-url:
name: Test Setup using URL
Expand Down Expand Up @@ -96,6 +97,18 @@ jobs:
echo "Setup ORAS using URL without checksum should fail, but succeeded."
exit 1
- name: Setup ORAS using checksum without url
id: no-url
continue-on-error: true
uses: ./
with:
checksum: ${{ needs.create-test-variables.outputs.checksum }}
- name: 'Should Fail: Setup ORAS using checksum without url'
if: steps.no-url.outcome != 'failure'
run: |
echo "Setup ORAS using checksum without url should fail, but succeeded."
exit 1
- name: Setup ORAS using URL and invalid checksum
id: invalid-checksum
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6692,8 +6692,8 @@ const os = __importStar(__nccwpck_require__(2037));
const releases_json_1 = __importDefault(__nccwpck_require__(2387));
// Get release info of a certain verion of ORAS CLI
function getReleaseInfo(version, url, checksum) {
// if customized ORAS CLI link and checksum are provided, version is ignored
if (url && checksum) {
// if customized ORAS CLI link and checksum are provided, version is ignored
return {
checksum: checksum,
url: url
Expand Down
2 changes: 1 addition & 1 deletion src/lib/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface releases {

// Get release info of a certain verion of ORAS CLI
export function getReleaseInfo(version: string, url: string, checksum: string) {
// if customized ORAS CLI link and checksum are provided, version is ignored
if (url && checksum) {
// if customized ORAS CLI link and checksum are provided, version is ignored
return {
checksum: checksum,
url: url
Expand Down

0 comments on commit 23e5458

Please sign in to comment.