Skip to content

Commit 5be3511

Browse files
committed
build: fetch pull request details instead of relying on event
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent da7198b commit 5be3511

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

.github/workflows/labeler.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,26 @@ jobs:
6767

6868
# Add "First-time Contributor" label if PR is from a first-time contributor:
6969
- name: 'Add "First-time Contributor" label if PR is from a first-time contributor'
70-
if: ${{ ( github.event.action == 'opened' || github.event.action == 'reopened' ) && github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' }}
70+
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
7171
# Pin action to full-length commit SHA
7272
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
7373
with:
7474
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
7575
script: |
76-
const labels = context.payload.pull_request.labels.map( label => label.name );
77-
if ( !labels.includes( 'First-time Contributor' ) ) {
78-
await github.rest.issues.addLabels({
79-
'owner': context.repo.owner,
80-
'repo': context.repo.repo,
81-
'issue_number': context.payload.pull_request.number,
82-
'labels': [ 'First-time Contributor' ]
83-
});
76+
const { data: pr } = await github.rest.pulls.get({
77+
'owner': context.repo.owner,
78+
'repo': context.repo.repo,
79+
'pull_number': context.payload.pull_request.number
80+
});
81+
if ( pr.author_association === 'FIRST_TIME_CONTRIBUTOR' ) {
82+
const labels = context.payload.pull_request.labels.map( label => label.name );
83+
if ( !labels.includes( 'First-time Contributor' ) ) {
84+
await github.rest.issues.addLabels({
85+
'owner': context.repo.owner,
86+
'repo': context.repo.repo,
87+
'issue_number': context.payload.pull_request.number,
88+
'labels': [ 'First-time Contributor' ]
89+
});
8490
}
8591
8692
# Add "Needs Review" label when PR is opened and not a draft:

0 commit comments

Comments
 (0)