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

ci: update of files from global .github repo #129

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions .github/workflows/automerge-for-humans-merging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,26 @@ jobs:
});

const commits = await github.paginate(commitOpts);
return commits;

if (commits.length === 0) {
core.setFailed('No commits found in the PR');
return '';
}

// Get unique authors from the commits list
const authors = commits.reduce((acc, commit) => {
const username = commit.author?.login || commit.commit.author?.name;
if (username && !acc[username]) {
acc[username] = {
name: commit.commit.author?.name,
email: commit.commit.author?.email,
}
}

return acc;
}, {});

return authors;
} catch (error) {
core.setFailed(error.message);
return [];
Expand All @@ -51,26 +70,13 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const commits = ${{ steps.authors.outputs.result }};
const authors = ${{ steps.authors.outputs.result }};

if (commits.length === 0) {
core.setFailed('No commits found in the PR');
if (Object.keys(authors).length === 0) {
core.setFailed('No authors found in the PR');
return '';
}

// Get unique authors from the commits list
const authors = commits.reduce((acc, commit) => {
const username = commit.author?.login || commit.commit.author?.name;
if (username && !acc[username]) {
acc[username] = {
name: commit.commit.author?.name,
email: commit.commit.author?.email,
}
}

return acc;
}, {});

// Create a string of the form "Co-authored-by: Name <email>"
// ref: https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors
const coAuthors = Object.values(authors).map(author => {
Expand Down