From d17a3a44f344cd88efa1981eeb2ebf0a9647c17f Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 15:13:13 -0700 Subject: [PATCH 1/8] Yet another test of the GHA move-issues. failed when issue didn't exist. Added more elegant failures. --- .github/workflows/move-issues.yml | 70 +++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/.github/workflows/move-issues.yml b/.github/workflows/move-issues.yml index 9578693..8b76fd8 100644 --- a/.github/workflows/move-issues.yml +++ b/.github/workflows/move-issues.yml @@ -1,4 +1,4 @@ -name: Move linked issues through workflow +name: Chagne status of PR linked issues on: pull_request: @@ -21,20 +21,22 @@ jobs: github-token: ${{ secrets.ORG_PROJECTS_TOKEN }} script: | // === CONFIG === - const orgLogin = "Seafood-Globalization-Lab"; // hardcoded org + const orgLogin = "Seafood-Globalization-Lab"; // org slug const projectNumber = 1; // from URL const fieldName = "Status"; // field in Project const targetStatus = "đŸ§Ē QA / Staging"; // target option // ============== const prBody = context.payload.pull_request?.body || ""; - const issueRefs = prBody.match(/#\d+/g) || []; + // Match "#123" or "repo#123" or "org/repo#123" + const issueRefs = prBody.match(/([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)?#\d+/g) || []; + if (issueRefs.length === 0) { - console.log("No linked issues found in PR body"); + console.log("â„šī¸ No linked issues found in PR body"); return; } - // Get project and its fields at ORG level + // Get project and its fields const { organization } = await github.graphql(` query($org: String!, $number: Int!) { organization(login: $org) { @@ -55,35 +57,58 @@ jobs: `, { org: orgLogin, number: projectNumber }); if (!organization || !organization.projectV2) { - throw new Error(`Project ${projectNumber} not found for org ${orgLogin}`); + throw new Error(`❌ Project ${projectNumber} not found for org ${orgLogin}`); } const project = organization.projectV2; const statusField = project.fields.nodes.find(f => f.name === fieldName); - if (!statusField) throw new Error(`Field '${fieldName}' not found`); + if (!statusField) throw new Error(`❌ Field '${fieldName}' not found`); const option = statusField.options.find(o => o.name === targetStatus); - if (!option) throw new Error(`Option '${targetStatus}' not found`); + if (!option) throw new Error(`❌ Option '${targetStatus}' not found`); + + // Process each ref + for (const ref of issueRefs) { + const match = ref.match(/^(?:(?[^/]+)\/(?[^#]+))?#(?\d+)$/); + if (!match || !match.groups) { + console.log(`âš ī¸ Skipping invalid ref '${ref}'`); + continue; + } - for (const issueRef of issueRefs) { - const issueNumber = parseInt(issueRef.replace("#","")); - console.log(`Moving issue #${issueNumber} → ${targetStatus}`); + const owner = match.groups.owner || context.repo.owner; + const repo = match.groups.repo || context.repo.repo; + const issueNumber = parseInt(match.groups.num, 10); - // Get issue node ID + if (isNaN(issueNumber)) { + console.log(`âš ī¸ Skipping invalid number in ref '${ref}'`); + continue; + } + + // Fetch issue or PR const { repository } = await github.graphql(` query($owner: String!, $repo: String!, $number: Int!) { repository(owner: $owner, name: $repo) { - issue(number: $number) { id } + issueOrPullRequest(number: $number) { + __typename + ... on Issue { id } + } } } - `, { - owner: context.repo.owner, - repo: context.repo.repo, - number: issueNumber - }); + `, { owner, repo, number: issueNumber }); + + if (!repository || !repository.issueOrPullRequest) { + console.log(`âš ī¸ ${owner}/${repo}#${issueNumber} not found, skipping`); + continue; + } - const issueId = repository.issue.id; + if (repository.issueOrPullRequest.__typename !== "Issue") { + console.log(`â„šī¸ ${owner}/${repo}#${issueNumber} is a ${repository.issueOrPullRequest.__typename}, skipping`); + continue; + } + + const issueId = repository.issueOrPullRequest.id; + console.log(`âžĄī¸ Processing ${owner}/${repo}#${issueNumber}`); - // Add to project + // Add to project (idempotent if already present) const addResp = await github.graphql(` mutation($projectId: ID!, $contentId: ID!) { addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) { @@ -93,8 +118,9 @@ jobs: `, { projectId: project.id, contentId: issueId }); const itemId = addResp.addProjectV2ItemById.item.id; + console.log(` â†ŗ Added/reused project item ${itemId}`); - // Update Status + // Update Status field await github.graphql(` mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) { updateProjectV2ItemFieldValue(input: { @@ -112,4 +138,6 @@ jobs: fieldId: statusField.id, optionId: option.id }); + + console.log(` ✅ Moved ${owner}/${repo}#${issueNumber} → ${targetStatus}`); } From 23b03d248b43b62f4781e49d7d576c66709860ce Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 15:29:45 -0700 Subject: [PATCH 2/8] possible fix for failing R-CMD-check GHA. test on two OS and with latest version of R --- .github/workflows/R-CMD-check.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index fe537d4..5b1ce7e 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -8,13 +8,13 @@ on: jobs: R-CMD-check: - runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.os }} (R ${{ matrix.config.r }}) + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} (R latest) strategy: fail-fast: false matrix: - os: [macOS-latest, ubuntu-latest] + os: [ubuntu-latest, macos-latest] env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -26,8 +26,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: ${{ matrix.config.r }} - http-user-agent: ${{ matrix.config.http-user-agent }} + r-version: 'latest' use-public-rspm: true - name: Install dependencies @@ -47,5 +46,5 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results + name: ${{ matrix.os }}-r-latest-results path: check From e28241b29f320c81ba448f8b515010daf0dde723 Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 15:42:00 -0700 Subject: [PATCH 3/8] R-CMD-check clean up. Failing checks on Github --- .Rbuildignore | 2 ++ DESCRIPTION | 9 +-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 929119f..2e3e298 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -16,4 +16,6 @@ ^inst$ ^qa$ ^venv$ +^\.github$ + diff --git a/DESCRIPTION b/DESCRIPTION index 4b5cfc7..bfc0de5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,23 +28,19 @@ Description: ARTIS (Aquatic Resource Trade in Species) is a global model allocate seafood trade and production data, and to compute consumption and trade-flow metrics. Designed to support reproducible research and policy-relevant analysis of seafood systems. -License: Apache License (>= 2.0) +License: Apache License (>= 2.0) | file LICENSE URL: https://github.com/Seafood-Globalization-Lab/artis-model BugReports: https://github.com/Seafood-Globalization-Lab/artis-model/issues Depends: R (>= 4.1.0) Imports: - aws.s3, - cli, aws.s3, cli, countrycode, data.table, DBI, doParallel, - DBI, - doParallel, dplyr, foreach, future, @@ -53,14 +49,11 @@ Imports: magrittr, parallel, qs2, - qs2, readxl, reticulate, stringr, tibble, tidyr, - qs2, - DBI, utils Suggests: duckdb, From 26bd6698d72684fa9b78594ca42d41b5e6488b0f Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 15:54:04 -0700 Subject: [PATCH 4/8] change R-CMD-check to not fail with warnings. updated description --- .github/workflows/R-CMD-check.yml | 3 +++ DESCRIPTION | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 5b1ce7e..39c4319 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -36,6 +36,9 @@ jobs: shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 + with: + error-on: '"error"' # only fail if there are actual errors + args: '--no-manual' # optional: skip manual build to save time - name: Show testthat output if: always() diff --git a/DESCRIPTION b/DESCRIPTION index bfc0de5..12a8aec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -57,6 +57,7 @@ Imports: utils Suggests: duckdb, + arrow Encoding: UTF-8 LazyData: true RoxygenNote: 7.3.2 From 5a6b087a35e96b55016f98eb1ebbe9dfe48313cb Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 15:58:16 -0700 Subject: [PATCH 5/8] yet another iteration of the R-CMD-check --- .github/workflows/R-CMD-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 39c4319..d060c19 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -37,8 +37,8 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: - error-on: '"error"' # only fail if there are actual errors - args: '--no-manual' # optional: skip manual build to save time + error-on: error # only fail if there are actual errors + args: --no-manual # optional: skip manual build to save time - name: Show testthat output if: always() From 558976ca6973d401d8d78a3f389b0b52bb6a885a Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 16:03:55 -0700 Subject: [PATCH 6/8] tiny fix --- .github/workflows/R-CMD-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index d060c19..07e2c40 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -37,7 +37,7 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: - error-on: error # only fail if there are actual errors + error-on: "error" # only fail if there are actual errors args: --no-manual # optional: skip manual build to save time - name: Show testthat output From 52557456dc59d1d84be4fefe342fc45386fdf32f Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 16:10:53 -0700 Subject: [PATCH 7/8] another annoying tiny fix --- .github/workflows/R-CMD-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 07e2c40..ed564d9 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -38,7 +38,7 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: error-on: "error" # only fail if there are actual errors - args: --no-manual # optional: skip manual build to save time + args: "--no-manual" # optional: skip manual build to save time - name: Show testthat output if: always() From 1e3e4f6b4368f016206a98d1f6021836e3613d7c Mon Sep 17 00:00:00 2001 From: theamarks Date: Tue, 30 Sep 2025 16:24:25 -0700 Subject: [PATCH 8/8] sick of chatgpt failing --- .github/workflows/R-CMD-check.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index ed564d9..02d75d5 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -37,8 +37,10 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: - error-on: "error" # only fail if there are actual errors - args: "--no-manual" # optional: skip manual build to save time + args: '"--no-manual"' + error-on: '"error"' + check-dir: '"check"' + - name: Show testthat output if: always()