Proyek Acction Autogrades Github ini berdasarkan pada set metrik yang dapat dikonfigurasi dan memberikan umpan balik tentang permintaan tarik (atau komitmen tunggal) di GitHub. Saya menggunakan tindakan ini untuk secara otomatis menilai proyek siswa dalam kuliah saya di Munich University of Applied Sciences.
Anda dapat melihat hasil dari tindakan ini dalam contoh permintaan tarik dan output GitHub yang terkait. Contoh nyata lainnya terlihat dalam permintaan tarik dan memeriksa hasil proyek siswa palsu.
Hasil tindakan dapat digunakan untuk membuat berbagai lencana yang menunjukkan status proyek saat ini. Tindakan tersebut menulis hasil tindakan ke file yang disebut metrics.env di ruang kerja. File ini dapat digunakan untuk membuat lencana menggunakan tindakan lencana GitHub. Cuplikan berikut menunjukkan cara membuat beberapa lencana untuk proyek Anda, contoh lengkapnya terlihat dalam alur kerja autograding saya.
[... Autograding, see above ... ]
- name : Write metrics to GitHub output
id : metrics
run : |
cat metrics.env >> "${GITHUB_OUTPUT}"
mkdir -p badges
- name : Generate the badge SVG image for the line coverage
uses : emibcn/[email protected]
with :
label : ' Line coverage '
status : ${{ steps.metrics.outputs.line }}%
color : ' green '
path : badges/line-coverage.svg
- name : Generate the badge SVG image for the branch coverage
uses : emibcn/[email protected]
with :
label : ' Branch coverage '
status : ${{ steps.metrics.outputs.branch }}%
color : ' green '
path : badges/branch-coverage.svg
- name : Generate the badge SVG image for the mutation coverage
uses : emibcn/[email protected]
with :
label : ' Mutation coverage '
status : ${{ steps.metrics.outputs.mutation }}%
color : ' green '
path : badges/mutation-coverage.svg
- name : Generate the badge SVG image for the style warnings
uses : emibcn/[email protected]
with :
label : ' Style warnings '
status : ${{ steps.metrics.outputs.style }}
color : ' orange '
path : badges/style-warnings.svg
- name : Generate the badge SVG image for the potential bugs
uses : emibcn/[email protected]
with :
label : ' Potential Bugs '
status : ${{ steps.metrics.outputs.bugs }}
color : ' red '
path : badges/bugs.svg
- name : Commit updated badges
continue-on-error : true
run : |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add badges/*.svg
git commit -m "Update badges with results from latest autograding" || true
- name : Push updated badges to GitHub repository
uses : ad-m/github-push-action@master
if : ${{ success() }}
with :
github_token : ${{ secrets.GITHUB_TOKEN }}
branch : main