Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer node16 action to support macOS and Windows runners #36

Merged
merged 4 commits into from
Apr 19, 2022

Conversation

umireon
Copy link
Contributor

@umireon umireon commented Mar 24, 2022

Implemented the same functionality as fetch_github_asset.sh in index.ts and made this action node16 action.
By this change, macOS and Windows runners on GitHub Actions will be supported.

@umireon umireon force-pushed the node16 branch 5 times, most recently from 66a4d09 to 213b3ec Compare March 24, 2022 07:30
Implemented the same functionality as fetch_github_asset.sh in index.ts and made this action node16 action.
By this change, macOS and Windows runners on GitHub Actions will be supported.
@dsaltares
Copy link
Owner

Thanks for your contribution, it's really significant.

I hadn't given any thought to supporting Windows and MacOS runners. That sounds great for sure!

However, it does have significant implications as it changes the language of this repo from bash scripting to Typescript. I'm actually more familiar with TS than bash but the change needs to be reviewed a bit more closely as it's, essentially, a full rewrite. It may have different implications for other contributors.

Please bear with me while I go through it. Given personal circumstances, it may take me over a week.

Copy link
Owner

@dsaltares dsaltares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have 1 question really, but it looks pretty good.
I will do some refactoring later on and finally, add unit tests! Once it's merged.

"@typescript-eslint"
],
"rules": {
"sort-keys": "error",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is merged, I may make some changes to the eslint config and potentially add prettier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please feel free, I don't have any strong opinions about that. These settings are just what I always use in my personal projects 😆

}

const MAX_RETRY = 5
const RETRY_INTERVAL = 1000
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we may want to replace the manual retry implementation with something like async-retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

const file = core.getInput('file', { required: true })
const target = inputTarget === '' ? file : inputTarget

const octokit = github.getOctokit(token)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended to implement the same behavior as the bash script.

@dsaltares
Copy link
Owner

@umireon It does look like the integration test is failing, would you be able to look into it please? Thanks!

@umireon
Copy link
Contributor Author

umireon commented Mar 29, 2022

@dsaltares It seems that the GitHub authorization mechanism is broken now. Please re-run the test later.

@umireon
Copy link
Contributor Author

umireon commented Mar 29, 2022

The existing Docker action is also broken now. The problem should be in the GitHub infrastructure.
https://github.com/umireon/fetch-gh-release-asset-test/runs/5737474231?check_suite_focus=true

@dsaltares
Copy link
Owner

@umireon GH's status page is green https://www.githubstatus.com and the error is related to API rate limiting.

image

@umireon
Copy link
Contributor Author

umireon commented Mar 29, 2022

@dsaltares It hits the API limit due to the requests are not authorized against the GitHub API despite the correct Authorization header being present.
I'm pretty sure this is a GitHub outage because this code worked yesterday without errors many times.
I will ask for GitHub support for this phenomenon.

@umireon
Copy link
Contributor Author

umireon commented Mar 29, 2022

@dsaltares I've created a support ticket to GitHub. Please wait for the response from GitHub support.

@umireon
Copy link
Contributor Author

umireon commented Apr 4, 2022

Still no response from GitHub. I had created the ticket from the paid organization so the response would be soon.

@umireon
Copy link
Contributor Author

umireon commented Apr 7, 2022

@dsaltares I talked with GitHub Support and managed to fix the problems.
Please re-run the integration tests.

@dsaltares
Copy link
Owner

Great stuff, thanks @umireon!

@dsaltares dsaltares merged commit 03da7c0 into dsaltares:master Apr 19, 2022
@guilhermeblanco
Copy link

guilhermeblanco commented Apr 19, 2022

This PR merge broke our pipeline.
It seems that since we now assume a well-formed version as part of the getRelease function, it completely ignored the scenario where you may be downloading draft assets (which means release version is "untagged-XXX", for example: untagged-f8c3edf8af6344f60679).

What we experience now is a "Malformed version" error when attempting to download assets, as shown in the picture below.
Screenshot from 2022-04-19 10-31-15

Here is a sample that reflects how we do with drafts:

name: build-artifact

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Draft new release
        id: draft_release
        uses: release-drafter/release-drafter@v5
        with:
          config-name: release-drafter.yml
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Upload assets
        id: upload_assets
        run: |
          gh release upload --clobber ${{ env.VERSION }} ${{ env.FILES }}
        env:
          GITHUB_TOKEN: ${{ secrets.GIT_PERSONAL_TOKEN }}
          VERSION: ${{ steps.draft_release.outputs.tag_name }}
          FILES: |
            release_asset.jar

    outputs:
      release_id: ${{ steps.draft_release.outputs.id }}
      release_name: ${{ steps.draft_release.outputs.name }}
      release_tag: ${{ steps.draft_release.outputs.tag_name }}
      release_url: ${{ steps.draft_release.outputs.html_url }}
      release_body: ${{ steps.draft_release.outputs.body }}
      release_upload_url: ${{ steps.draft_release.outputs.upload_url }}

  reelase:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Download release asset
        id: download_asset
        uses: dsaltares/fetch-gh-release-asset@master
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          version: ${{ needs.build.outputs.release_id }}
          file: release_asset.jar
          target: release_asset.jar

@dsaltares
Copy link
Owner

@guilhermeblanco apologies, can you open an issue for this? In the meantime, can you pin your pipeline to the latest release instead of master? That will unblock you.

@guilhermeblanco
Copy link

@guilhermeblanco apologies, can you open an issue for this? In the meantime, can you pin your pipeline to the latest release instead of master? That will unblock you.

Done. #38

@umireon
Copy link
Contributor Author

umireon commented Apr 21, 2022

#40 will fix #38 sorry for inconvinience

BSteffaniak pushed a commit to FlatLang/fetch-release-asset that referenced this pull request Oct 12, 2022
Prefer node16 action to support macOS and Windows runners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants