We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The action should update the list of Authors
The action replaces the list of authors
We could change the run function :
export async function run() { try { const { context } = github const options = getOptions() const octokit = getOctokit() const authors = await getAuthors() const lines: string[] = [] core.debug(JSON.stringify(options, null, 2)) core.debug(JSON.stringify(authors, null, 2)) mustache.parse(options.template) if (options.sort === 'commits') { authors.sort((a, b) => a.commits - b.commits) } const filteredAuthors = authors.filter((author) => options.bots || !author.name.includes('[bot]') ) const getContent = async () => { try { return await octokit.rest.repos.getContent({ ...github.context.repo, path: options.path, }) } catch (err) { return null } } const res = await getContent() const oldContent = res ? Buffer.from((res.data as any).content, 'base64').toString() : '' core.debug(`previous content: \n${oldContent}`) const oldAuthors = oldContent .split('\n') .map(line => line.trim()) .filter(line => line.length > 0) const newAuthorsSet = new Set(oldAuthors) filteredAuthors.forEach(author => { const renderedAuthor = mustache.render(options.template, author) newAuthorsSet.add(renderedAuthor) }) const newAuthorsArray = Array.from(newAuthorsSet) if (options.sort === 'alphabet') { newAuthorsArray.sort() } const newContent = newAuthorsArray.join('\n') core.debug(`generated content: \n${newContent}`) if (oldContent !== newContent) { await octokit.rest.repos.createOrUpdateFileContents({ ...context.repo, path: options.path, content: Buffer.from(newContent).toString('base64'), message: options.commit, sha: res ? (res.data as any).sha : undefined, }) core.info(`${oldContent ? 'Updated' : 'Generated'}: "${options.path}"`) } else { core.info(`No changes to "${options.path}"`) } } catch (e) { core.error(e) core.setFailed(e.message) } }
You can check here : https://github.com/EDM115/unzip-bot/commits/master/AUTHORS Especially here : EDM115/unzip-bot@943cee9?diff=unified
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected Behavior
The action should update the list of Authors
Current Behavior
The action replaces the list of authors
Possible Solution
We could change the run function :
Steps To Reproduce
You can check here : https://github.com/EDM115/unzip-bot/commits/master/AUTHORS
Especially here : EDM115/unzip-bot@943cee9?diff=unified
Additional Context
Your Environment
The text was updated successfully, but these errors were encountered: