-
Notifications
You must be signed in to change notification settings - Fork 0
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
[pull] master from OpenRefine:master #129
base: master
Are you sure you want to change the base?
Changes from all commits
5ed7f1e
1fc05ee
c961b3f
ab42257
ec40457
bb64817
6d9beba
1d9f07e
805ff8c
d5eb735
4cb7f58
a9f09c0
83cd7e3
6f8fa6c
5838cc1
aab588c
c1df3f0
dee36b1
a9ce1b4
f787ddd
b4b8de7
77eb12c
b42bdda
91f8abc
5c7f66b
4a104d6
4a587b6
67b9613
3c59a77
7aeb562
2151af9
5066f9a
524275b
d7cfe41
918cd79
e22ba0f
9ff0feb
6097cec
ba9b968
058e576
9629894
cef6a82
857d9ca
c178b6c
05ff957
a2199db
d5f8c40
6a65c6b
69ada25
98d01b5
fe54304
262a21d
db36862
9a70da0
7709df8
10cd91c
b9028ed
16f9c1a
53d139c
88abdcf
0240d6e
f0ca6f7
7fd4077
7ee2be1
cbf24f9
2591db1
e9e1887
e7e865b
7438984
3c1e1f8
01be686
6ba044c
6ea0542
4801fa7
9e82b2a
21aaf8a
e54f032
74330aa
494b663
cdbdf36
e6dbcfc
e3cee73
0d68622
0a7e3a9
d7fbc44
f487880
ebbcba1
cfe9d37
ad64c16
602f880
c1a5dbb
e47f8a0
ad5b824
d0d03a6
2a76c0c
49f1ae4
ec7ebbc
a88c4db
669121b
68d9244
a602505
0685bd7
fb517c2
bb2cb40
926b309
db3417b
b11a535
85a0add
6cfab31
8dda95c
24edc6d
9354471
4a9a6fc
9e84586
bb50bcf
c700925
3b8991b
38b495a
3e42f5d
767e257
8a50391
b17e98f
2eaba59
b1e0caf
f116fff
20bd98f
83ee35c
4e4baad
519948a
a9b9a81
c216f7e
8244afe
3472861
fd81e5b
6cf7f46
929be57
58710e8
b77c5cc
f60b39e
ef77f34
75b7c9c
bdf319e
f38794e
ee56db0
7faee90
cb2ac61
c5e1da3
78bc6d5
f693b2d
05a3854
a80264f
07e44d2
81d6173
7784b51
e451373
a923d1d
95ca201
0a56497
23cf4e8
776ea56
e5feb1e
56f178e
f1332a3
db265a9
874a375
183246f
8ddbce9
a85442a
4be788e
c612edc
e67c5e9
7fd42ee
b8ce339
c6f1b07
8b6c359
f8ffaae
7bd7ab4
f1563c6
80028b3
c9282e1
62b0e69
1fcf41f
83883d1
47936cc
a814235
ef2f5d1
dbf33cc
0cf6047
4ccd0ed
db5fc77
c2bb43a
bd0a573
a03ee58
0675247
1233678
2a38a88
bd8f956
a2484b5
9f17e7d
6c91261
ef5c171
e493b61
6a86001
b9d4ba7
5dc97ea
a78e656
19e6b37
9469314
53919cf
a296552
9ed172d
24947a3
d87ae76
9fe3723
073d0e2
679411a
5a69bc5
c876bc6
28d5a0c
59ef6d8
88d9448
8379b94
62a7322
04f56b9
2b715bb
65c8c08
c66f68b
67254af
89db24e
805b10e
6387cb6
2f725cd
234e485
f4fa841
89c5df8
fbc7781
60ecbed
6dbe8c3
5a00230
017f50c
e28fc7c
733ffc7
d894a7c
337d4e2
423ef72
60e20e2
c0018e3
f275e4c
6d3c8d5
bb753de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
tab_width = 8 | ||
ij_continuation_indent_size = 8 | ||
ij_formatter_off_tag = @formatter:off | ||
ij_formatter_on_tag = @formatter:on | ||
ij_formatter_tags_enabled = true | ||
ij_smart_tabs = false | ||
ij_visual_guides = | ||
ij_wrap_on_typing = false | ||
|
||
|
||
[*.java] | ||
ij_java_class_count_to_use_import_on_demand = 99 | ||
ij_java_imports_layout = $*,java.**,|,javax.**,|,*,|,com.google.refine.**,org.openrefine.** | ||
ij_java_layout_static_imports_separately = true | ||
|
||
|
||
[*.less] | ||
indent_size = 2 | ||
|
||
[{*.bash,*.sh,*.zsh}] | ||
indent_size = 2 | ||
tab_width = 2 | ||
ij_shell_binary_ops_start_line = false | ||
ij_shell_keep_column_alignment_padding = false | ||
ij_shell_minify_program = false | ||
ij_shell_redirect_followed_by_space = false | ||
ij_shell_switch_cases_indented = false | ||
ij_shell_use_unix_line_separator = true | ||
|
||
|
||
[{*.graphqlconfig,*.graphqlrc,*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}] | ||
indent_size = 2 | ||
|
||
|
||
[{*.yaml,*.yml}] | ||
indent_size = 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
If you are having trouble with OpenRefine we suggest the following steps: | ||
|
||
1. Read through our [FAQ (frequently Asked Questions)](https://github.com/OpenRefine/OpenRefine/wiki/FAQ) | ||
2. Search for similar issues in our community email list archives: http://groups.google.com/group/openrefine/ | ||
3. Send an email to our community mailing list: openrefine@googlegroups.com | ||
2. Search the web for similar issues in our community | ||
3. Ask your question on [our forum](https://forum.openrefine.org) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "CodeQL Java" | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
paths: | ||
- '**/*.java' # Only trigger the workflow if Java files have changed | ||
pull_request: | ||
branches: [ "master" ] | ||
paths: | ||
- '**/*.java' | ||
|
||
jobs: | ||
analyze: | ||
if: github.repository == 'OpenRefine/OpenRefine' | ||
name: Analyze Java | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: 'java' | ||
|
||
- name: Build | ||
run: | | ||
./refine build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:java" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "CodeQL JavaScript" | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
paths: | ||
- '**/*.js' # Only trigger the workflow if JavaScript files have changed | ||
pull_request: | ||
branches: [ "master" ] | ||
paths: | ||
- '**/*.js' | ||
|
||
jobs: | ||
analyze: | ||
if: github.repository == 'OpenRefine/OpenRefine' | ||
name: Analyze JavaScript | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: 'javascript' | ||
|
||
- name: Build | ||
run: | | ||
./refine build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:javascript" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
name: Copy labels from issue to pull request | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, edited] | ||
|
||
jobs: | ||
transfer_tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r .github/workflows/label_transfer/requirements.txt | ||
pip freeze | ||
- name: Run Python label transfer script | ||
run: python .github/workflows/label_transfer/script.py ${{ github.event.number }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REPO: ${{ github.repository }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
requests | ||
lxml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import requests | ||
import os | ||
from lxml import html | ||
import sys | ||
import json | ||
|
||
# Config | ||
|
||
# list of labels that should not be transferred to PRs | ||
do_not_transfer = [ | ||
'good first issue', | ||
'good second issue', | ||
'imported from old code repo', | ||
'help wanted', | ||
'duplicate', | ||
'invalid', | ||
'question', | ||
'to be reviewed', | ||
] | ||
|
||
# Internal | ||
|
||
repo = os.environ.get('GITHUB_REPO') | ||
github_token = os.environ.get('GITHUB_TOKEN') | ||
Comment on lines
+23
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script retrieves the GitHub repository name and token from environment variables but does not check whether these values are actually provided. If these environment variables are not set, the script will continue with repo = os.environ.get('GITHUB_REPO')
github_token = os.environ.get('GITHUB_TOKEN')
+if not repo or not github_token:
+ print("Environment variables GITHUB_REPO and GITHUB_TOKEN must be set.")
+ sys.exit(1) |
||
|
||
headers = { | ||
'Accept': 'application/vnd.github.v3+json', | ||
} | ||
|
||
if github_token: | ||
headers['Authorization'] = 'Bearer '+github_token | ||
|
||
def get_linked_issues(pr_number): | ||
""" | ||
Given a PR number, extract all the linked issue numbers from it. | ||
Sadly this is not supported by the API yet, so we just scrape the web UI. | ||
""" | ||
url = f'https://github.com/{repo}/pull/{pr_number}' | ||
page = requests.get(url) | ||
page.raise_for_status() | ||
parsed = html.document_fromstring(page.text) | ||
matches = parsed.xpath('//form/span[@class="Truncate truncate-with-responsive-width my-1"]/a') | ||
for match in matches: | ||
yield int(match.attrib['href'].split('/')[-1]) | ||
|
||
def get_issue_labels(issue_number): | ||
""" | ||
Returns all the labels in a given issue / PR | ||
""" | ||
url = f'https://api.github.com/repos/{repo}/issues/{issue_number}/labels' | ||
response = requests.get(url, headers=headers) | ||
response.raise_for_status() | ||
return [ tag['name'] for tag in response.json() ] | ||
|
||
def transfer_issue_labels(pr_number): | ||
""" | ||
Transfers labels from all the linked issues to the PR | ||
""" | ||
linked_issues = get_linked_issues(pr_number) | ||
if not linked_issues: | ||
print('No linked issues found') | ||
all_labels = [ label for issue in linked_issues for label in get_issue_labels(issue) ] | ||
to_transfer = [ label for label in all_labels if label not in do_not_transfer ] | ||
current_labels = get_issue_labels(pr_number) | ||
missing_labels = [ label for label in to_transfer if label not in current_labels ] | ||
if not missing_labels: | ||
return | ||
new_labels = current_labels + missing_labels | ||
url = f'https://api.github.com/repos/{repo}/issues/{pr_number}/labels' | ||
print(f'adding {missing_labels} to PR #{pr_number}') | ||
if not github_token: | ||
print('no GITHUB_TOKEN, skipping') | ||
else: | ||
resp = requests.put(url, headers=headers, data=json.dumps({'labels':new_labels})) | ||
resp.raise_for_status() | ||
Comment on lines
+74
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script makes a PUT request to the GitHub API but does not handle potential exceptions that could occur during this operation. For example, the request could fail due to network issues, or the API could return an error response. It would be better to wrap this operation in a try-except block and handle potential +try:
resp = requests.put(url, headers=headers, data=json.dumps({'labels':new_labels}))
resp.raise_for_status()
+except requests.exceptions.RequestException as e:
+ print(f"An error occurred while updating labels: {str(e)}") |
||
|
||
if __name__ == '__main__': | ||
transfer_issue_labels(sys.argv[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script imports several modules but does not handle the case where these modules might not be installed. This could lead to a
ModuleNotFoundError
if the script is run in an environment where any of these modules are not installed. It would be better to wrap these import statements in a try-except block and provide a user-friendly message if any module is not found.