Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 21, 2024
1 parent a5c6ae8 commit 5285789
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/zerocracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
options: |
token=${{ secrets.GITHUB_TOKEN }}
max_events=2
repositories=yegor256/judges,yegor256/factbase,zerocracy/*
repositories=yegor256/judges,yegor256/factbase,zerocracy/judges-action,zerocracy/pages-action
factbase: zerocracy.fb
trim: 5
- uses: zerocracy/pages-action@master
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

source 'https://rubygems.org'

gem 'factbase', '0.0.29'
gem 'factbase', '0.0.30'
gem 'faraday', '2.9.0'
gem 'faraday-retry', '2.2.1'
gem 'judges', '0.0.30'
gem 'judges', '0.0.31'
gem 'minitest', '5.22.3'
gem 'obk', '0.3.1'
gem 'octokit', '8.1.0'
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GEM
ast (2.4.2)
backtrace (0.4.0)
base64 (0.2.0)
factbase (0.0.29)
factbase (0.0.30)
json (~> 2.7)
loog (~> 0.2)
nokogiri (~> 1.10)
Expand All @@ -19,9 +19,9 @@ GEM
faraday (~> 2.0)
gli (2.21.1)
json (2.7.2)
judges (0.0.30)
judges (0.0.31)
backtrace (~> 0.3)
factbase (~> 0.0.29)
factbase (~> 0.0.30)
gli (~> 2.21)
loog (~> 0.2)
nokogiri (~> 1.10)
Expand All @@ -44,7 +44,7 @@ GEM
ast (~> 2.4.1)
racc
public_suffix (5.0.5)
racc (1.7.3)
racc (1.8.0)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
Expand Down Expand Up @@ -77,10 +77,10 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
factbase (= 0.0.29)
factbase (= 0.0.30)
faraday (= 2.9.0)
faraday-retry (= 2.2.1)
judges (= 0.0.30)
judges (= 0.0.31)
minitest (= 5.22.3)
obk (= 0.3.1)
octokit (= 8.1.0)
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ The `zerocracy/pages-action` plugin is responsible for rendering
the summary HTML page: its configuration is not explained here,
check its [own repository](https://github.com/zerocracy/pages-action).

## Awards & Punishments

To be rewarded, do the following:

* Create a new issue, which is labeled as `bug`, `enhancement`, or `question`
* Put one of those labels to an issue
* Merge a pull request
* Review a pull request
* Create a new release

To avoid punishment, do the following:

* Triage issues timely
* Review and merge/reject pull requests timely
* Release frequently
* Keep GitHub Action jobs green

* Punish architect for ignoring bug reports
* Punish for long merged pull request
* Punish for stale pull request
* Punish architect for lack of fresh releases
* Punish for rejected bug report
* Punish for rejected pull request


Check failure on line 102 in README.md

View workflow job for this annotation

GitHub Actions / markdown-lint

Multiple consecutive blank lines [Expected: 1; Actual: 2]
## How to Contribute

In order to test this action, just run (provided, you have
Expand Down
11 changes: 7 additions & 4 deletions judges/scan/scan_github_events/scan_github_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def put_new_event(fbt, json)
n.repository = json[:repo][:id]
n.who = json[:actor][:id] if json[:actor]
n.details =
"A new event ##{json[:id]} happened in GitHub '#{json[:repo][:name]}' repository " \
"A new event ##{json[:id]} happened in GitHub #{json[:repo][:name]} repository " \
"(id: #{json[:repo][:id]}) of type '#{json[:type]}', " \
"with the creation time '#{json[:created_at].iso8601}'."
"with the creation time #{json[:created_at].iso8601}."

case json[:type]
when 'PushEvent'
Expand All @@ -42,10 +42,8 @@ def put_new_event(fbt, json)
when 'IssuesEvent'
n.issue = json[:payload][:issue][:number]
if json[:payload][:action] == 'closed'
n.who = 1 # TODO: we should figure it out!
n.what = 'issue-closed'
elsif json[:payload][:action] == 'opened'
n.who = 1 # TODO: we should figure it out!
n.what = 'issue-opened'
end

Expand Down Expand Up @@ -73,11 +71,16 @@ def put_new_event(fbt, json)
end
end

# Taking the largest ID of GitHub event that was seen so far
largest = fb.query('(and (exists repository) (max event_id))').each.to_a[0]
largest = largest.event_id unless largest.nil?

seen = 0
catch :stop do
each_repo do |repo|
octo.repository_events(repo).each do |json|
next unless fb.query("(eq event_id #{json[:id]})").each.to_a.empty?
throw :stop if largest && json[:event_id] <= largest
$loog.info("Detected new event ##{json[:id]} in #{json[:repo][:name]}: #{json[:type]}")
fb.txn do |fbt|
put_new_event(fbt, json)
Expand Down
12 changes: 12 additions & 0 deletions lib/octo/fake_octokit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def repository_events(repo)
payload: {
push_id: 42
},
actor: {
id: 888,
name: 'torvalds'
},
created_at: Time.now
},
{
Expand All @@ -87,6 +91,10 @@ def repository_events(repo)
number: 42
}
},
actor: {
id: 888,
name: 'torvalds'
},
created_at: Time.now
},
{
Expand All @@ -102,6 +110,10 @@ def repository_events(repo)
number: 42
}
},
actor: {
id: 888,
name: 'torvalds'
},
created_at: Time.now
}
]
Expand Down

1 comment on commit 5285789

@0pdd
Copy link

@0pdd 0pdd commented on 5285789 May 21, 2024

Choose a reason for hiding this comment

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

I wasn't able to retrieve PDD puzzles from the code base and submit them to github. If you think that it's a bug on our side, please submit it to yegor256/0pdd:

set -x && set -e && set -o pipefail && cd /tmp/0pdd20240521-2-torw3x/Z2l0QGdpdGh1Yi5jb206emVyb2NyYWN5L2p1ZGdlcy1hY3Rpb24uZ2l0 && pdd -v -f /tmp/20240521-3545-7hnxbu [1]: + set -e + set -o pipefail + cd /tmp/0pdd20240521-2-torw3x/Z2l0QGdpdGh1Yi5jb206emVyb2NyYWN5L2p1ZGdlcy1hY3Rpb24uZ2l0 + pdd -v -f...

Please, copy and paste this stack trace to GitHub:

UserError
set -x && set -e && set -o pipefail && cd /tmp/0pdd20240521-2-torw3x/Z2l0QGdpdGh1Yi5jb206emVyb2NyYWN5L2p1ZGdlcy1hY3Rpb24uZ2l0 && pdd -v -f /tmp/20240521-3545-7hnxbu [1]:
+ set -e
+ set -o pipefail
+ cd /tmp/0pdd20240521-2-torw3x/Z2l0QGdpdGh1Yi5jb206emVyb2NyYWN5L2p1ZGdlcy1hY3Rpb24uZ2l0
+ pdd -v -f /tmp/20240521-3545-7hnxbu

My version is 0.24.0
Ruby version is 3.1.4 at x86_64-linux
Reading from root dir /tmp/0pdd20240521-2-torw3x/Z2l0QGdpdGh1Yi5jb206emVyb2NyYWN5L2p1ZGdlcy1hY3Rpb24uZ2l0
Reading .github/workflows/actionlint.yml ...
Reading .github/workflows/hadolint.yml ...
Reading .github/workflows/license.yml ...
Reading .github/workflows/make.yml ...
Reading .github/workflows/markdown-lint.yml ...
Reading .github/workflows/rake.yml ...
Reading .github/workflows/shellcheck.yml ...
Reading .github/workflows/up.yml ...
Reading .github/workflows/yamllint.yml ...
Reading .github/workflows/zerocracy.yml ...
Reading .gitignore ...
Reading .rubocop.yml ...
Reading .rultor.yml ...
Reading Dockerfile ...
Reading Gemfile ...
Reading Gemfile.lock ...
Reading LICENSE.txt ...
Reading Makefile ...
Reading README.md ...
Reading Rakefile ...
Reading action.yml ...
Reading entry.sh ...
Reading judges/catch/catch_accepted_bug/catch-simple.yml ...
Reading judges/catch/catch_accepted_bug/catch_accepted_bug.rb ...
ERROR: ERROR: judges/catch/catch_accepted_bug/catch_accepted_bug.rb; PDD::Error at judges/catch/catch_accepted_bug/catch_accepted_bug.rb:40: TODO found, but puzzle can't be parsed, most probably because TODO is not followed by a puzzle marker, as this page explains: https://github.com/cqfn/pdd#how-to-format
If you can't understand the cause of this issue or you don't know how to fix it, please submit a GitHub issue, we will try to help you: https://github.com/cqfn/pdd/issues. This tool is still in its beta version and we will appreciate your feedback. Here is where you can find more documentation: https://github.com/cqfn/pdd/blob/master/README.md.
Exit code is 1

/app/objects/git_repo.rb:74:in `rescue in block in xml'
/app/objects/git_repo.rb:71:in `block in xml'
/app/vendor/ruby-3.1.4/lib/ruby/3.1.0/tempfile.rb:317:in `open'
/app/objects/git_repo.rb:70:in `xml'
/app/objects/puzzles.rb:46:in `deploy'
/app/objects/jobs/job.rb:38:in `proceed'
/app/objects/jobs/job_starred.rb:32:in `proceed'
/app/objects/jobs/job_recorded.rb:31:in `proceed'
/app/objects/jobs/job_emailed.rb:33:in `proceed'
/app/objects/jobs/job_commiterrors.rb:33:in `proceed'
/app/objects/jobs/job_detached.rb:48:in `exclusive'
/app/objects/jobs/job_detached.rb:36:in `block in proceed'
/app/objects/jobs/job_detached.rb:36:in `fork'
/app/objects/jobs/job_detached.rb:36:in `proceed'
/app/0pdd.rb:549:in `process_request'
/app/0pdd.rb:380:in `block in <top (required)>'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1804:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1804:in `block in compile!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1071:in `block (3 levels) in route!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1089:in `route_eval'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1071:in `block (2 levels) in route!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1120:in `block in process_route'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1118:in `catch'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1118:in `process_route'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1069:in `block in route!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1066:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1066:in `route!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1190:in `block in dispatch!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1161:in `catch'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1161:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1185:in `dispatch!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1001:in `block in call!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1161:in `catch'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1161:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1001:in `call!'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:990:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/rewindable_input.rb:25:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/deflater.rb:47:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/xss_header.rb:20:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/path_traversal.rb:18:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/json_csrf.rb:28:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/base.rb:53:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/base.rb:53:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-protection-4.0.0/lib/rack/protection/frame_options.rb:33:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/logger.rb:19:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/common_logger.rb:43:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:266:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:259:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/head.rb:15:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rack-3.0.9/lib/rack/method_override.rb:28:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:224:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:2115:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1674:in `block in call'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1890:in `synchronize'
/app/vendor/bundle/ruby/3.1.0/gems/sinatra-4.0.0/lib/sinatra/base.rb:1674:in `call'
/app/vendor/bundle/ruby/3.1.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service'
/app/vendor/bundle/ruby/3.1.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service'
/app/vendor/bundle/ruby/3.1.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run'
/app/vendor/bundle/ruby/3.1.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread'

Please sign in to comment.