Our great sponsors
-
Puts Debuggerer
Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Continuing on my story for My PhotoHub Image optimization GitHub Action, my approach was to convert files using JavaScript framework Sharp and shell script creates a repo and pushes the files to it. I pushed my script with my questions to ask how we should deploy the app. With this PR, I wanted to make sure my approach was ok and what the next steps would be.
async function uploadBtnClicked() { setUserMessage(''); setLoading(true); const octokit = new Octokit({ auth: token }); let username, repoCreated; try { username = await getUser(octokit); } catch (err) { console.error('Invalid PAT token'); setUserMessage('Sorry, could not find a user with the token'); setRepoCreated(false); setLoading(false); return; } setUserMessage('MyPhotoHub is creating a GitHub repository...'); repoCreated = await createRepo(octokit, username, repository); if (repoCreated) { console.info('Repo is created'); setUserMessage('GitHub repository has been created...'); setRepoCreated(true); } else { console.error('Error occurred while creating a repo'); setUserMessage('Sorry, something went wrong while creating a repository'); setRepoCreated(false); setLoading(false); } setUserMessage('Creating optimized images...'); const convertedFiles = await createOptimizedImages(images); ... setUserMessage('Adding images to repository...'); setUserMessage( `Process complete. You can check out https://github.com/${username}/${repository}` ); setLoading(false); }