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

a comwnt #3

Merged
merged 8 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
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
43 changes: 41 additions & 2 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,44 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Coveralls
uses: coverallsapp/github-action@v2
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "coverager"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverager.zip`, Buffer.from(download.data));

- name: 'Unzip artifact'
run: unzip coverager.zip

- name: Coveralls
uses: coverallsapp/github-action@v2

- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync('./coverage.json'));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Thank you for the PR!'
});

9 changes: 9 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ jobs:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake

- name: Save Coverage report
run: |
mkdir -p ./cc
cp /home/runner/work/space_invaders/space_invaders/coverage/.resultset.json ./cc/coverage.json
- uses: actions/upload-artifact@v4
with:
name: coverager
path: cc/
2 changes: 1 addition & 1 deletion .github/workflows/use_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Thank you for the PR!'
body: `Thank you for the PR! ${issue_number}`
});
1 change: 1 addition & 0 deletions app/invaders/invader.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Invader
private

# a comment
attr_reader :face
attr_reader :radar_signal

Expand Down
Loading