Skip to content

Commit

Permalink
Final Submission - Course Automation: Checking Open-Source Requiremen…
Browse files Browse the repository at this point in the history
…ts (#1068)

* Add a github action to check open-source requirements

* Add link for updated grading criteria
  • Loading branch information
oskstr authored Apr 21, 2021
1 parent 2def803 commit 4a4b243
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/open-source-requirement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Open Source Activity Check
on:
pull_request:
types:
- labeled
branches: [ 2021 ]

jobs:
check-repo-activity-for-pr:
if: github.event.label.name == 'contribution_to_opensource'
runs-on: ubuntu-latest
name: PR activity check
steps:
- name: Run action
id: index
uses: sfkwww/milkyway@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
text: ${{ github.event.pull_request.body }}
min_stars: 10
min_watchers: 10
min_contributors: 10
min_forks: 1
min_commits: 100
min_commits_last_year: 10
min_open_issues: 10
- name: Comment the results
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
[ ${{steps.index.outputs.repo}} ]
-----------------------
| Stat | Number | Pass |
|---|---|---|
|Stars ⭐ | ${{fromJSON(steps.index.outputs.stars).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.stars).pass] }} |
|Commits 📦 | ${{fromJSON(steps.index.outputs.commits).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.commits).pass] }} |
|Commits Last Year ⏱️ | ${{fromJSON(steps.index.outputs.commits_last_year).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.commits_last_year).pass] }} |
|Watchers 👀 | ${{fromJSON(steps.index.outputs.watchers).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.watchers).pass] }} |
|Contributors 🧑🏻‍🤝‍🧑🏻 | ${{fromJSON(steps.index.outputs.contributors).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.contributors).pass] }} |
|Forks 🍴 | ${{fromJSON(steps.index.outputs.forks).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.forks).pass] }} |
|Open Issues 🟢 | ${{fromJSON(steps.index.outputs.open_issues).count}} | ${{ fromJSON('["❌", "✔️"]')[fromJSON(steps.index.outputs.open_issues).pass] }} |
`
})
if (!${{steps.index.outputs.final_pass}}) {
core.setFailed('The repository did not meet the minimum requirements')
}

0 comments on commit 4a4b243

Please sign in to comment.