-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final Submission - Course Automation: Checking Open-Source Requiremen…
…ts (#1068) * Add a github action to check open-source requirements * Add link for updated grading criteria
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |