Skip to content
Open
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
45 changes: 45 additions & 0 deletions .github/workflows/first-time-contribution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'First time contributor'

on:
pull_request:
types: [opened]

jobs:
welcome_first_contributor:
runs-on: ubuntu-latest
if: github.event.pull_request.author_association == 'NONE'
steps:
- name: Add label and welcome comment with DCO check
uses: actions/github-script@v7
with:
script: |
// Add label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['first-time contributor']
});

// Check DCO

Choose a reason for hiding this comment

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

I am pretty sure DCO is already covered

const { data: commits } = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});

const hasDCO = commits.every(commit =>
commit.commit.message.includes('Signed-off-by:')
);

const dcoMessage = hasDCO
? ''
: '\n\n Please sign your commits or look the DCO.';

// Post comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `Welcome, New contributor! Thank you for submitting your PR on Score-Compose.${dcoMessage}\n\nPlease review our Contributing Guidelines [here](https://github.com/score-spec/score-compose/blob/main/CONTRIBUTING.md).\n\nA maintainer will review your pull request soon. Thank you for helping make Score better ♥️!`
});