From da515463231a37ba8f7a13037c91bd78fec723f4 Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Fri, 16 Jan 2026 12:52:43 +0000 Subject: [PATCH 1/6] Create workflow for automated reply to internal issues We get requests to assign open source contributors to internal issues. This workflow will let the ocf bot send an automated reply that this is not possible and direct to contribution guidelines. --- .github/workflows/internal-issue-comment.yml | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/internal-issue-comment.yml diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml new file mode 100644 index 0000000..2f89cfa --- /dev/null +++ b/.github/workflows/internal-issue-comment.yml @@ -0,0 +1,36 @@ +name: Reply to internal issue comment +run-name: Reply to internal issue comment by ${{ github.actor }} +on: + issue_comment: + types: + - created + +jobs: + maybe-add-comment: + runs-on: ubuntu-latest + if: ${{ !contains(github.event.issue.labels.*.name, 'contributions-welcome') && + !contains(github.event.issue.labels.*.name, 'good first issue') && + !github.event.issue.pull_request }} + permissions: + issues: write + steps: + - name: Check user not in core team + uses: tspascoal/get-user-teams-membership@v2 + id: teamAffiliation + with: + GITHUB_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} + username: ${{ github.event.comment.user.login }} + team: ocf-core + - name: Add comment + if: ${{ steps.teamAffiliation.outputs.isTeamMember == 'false' }} + run: | + gh issue comment "$NUMBER" --body "@${{ github.event.comment.user.login }} $BODY" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + BODY: > + Thank you for reaching out! Unfortunately, this issue is not suitable for open source + contribution and so hasn't been marked with "good first issue" or "contributions welcome". + Please consult our [contribution guidelines](https://github.com/openclimatefix#how-to-get-involved) for more information on how you can contribute, + and hope to see you around! From 4f2df5f3120c7401978340e4b121eca20a7fd3c2 Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:49:34 +0000 Subject: [PATCH 2/6] Change job name --- .github/workflows/internal-issue-comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml index 2f89cfa..f6d66e1 100644 --- a/.github/workflows/internal-issue-comment.yml +++ b/.github/workflows/internal-issue-comment.yml @@ -6,7 +6,7 @@ on: - created jobs: - maybe-add-comment: + comment-nocontribution: runs-on: ubuntu-latest if: ${{ !contains(github.event.issue.labels.*.name, 'contributions-welcome') && !contains(github.event.issue.labels.*.name, 'good first issue') && From 0e5841e164d7f5ce6794fc64200daa498986639b Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:56:23 +0000 Subject: [PATCH 3/6] Make workflow reusable --- .github/workflows/internal-issue-comment.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml index f6d66e1..8ea32e5 100644 --- a/.github/workflows/internal-issue-comment.yml +++ b/.github/workflows/internal-issue-comment.yml @@ -1,14 +1,13 @@ name: Reply to internal issue comment run-name: Reply to internal issue comment by ${{ github.actor }} on: - issue_comment: - types: - - created + workflow_call: jobs: comment-nocontribution: runs-on: ubuntu-latest - if: ${{ !contains(github.event.issue.labels.*.name, 'contributions-welcome') && + if: ${{ contains(github.event_name, 'issue_comment') && + !contains(github.event.issue.labels.*.name, 'contributions-welcome') && !contains(github.event.issue.labels.*.name, 'good first issue') && !github.event.issue.pull_request }} permissions: From 3bf025249ab548deb60db8d22895d3b3cb4b61df Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:58:08 +0000 Subject: [PATCH 4/6] Replace external workflow with API call by devsjc --- .github/workflows/internal-issue-comment.yml | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml index 8ea32e5..e57058e 100644 --- a/.github/workflows/internal-issue-comment.yml +++ b/.github/workflows/internal-issue-comment.yml @@ -13,15 +13,24 @@ jobs: permissions: issues: write steps: - - name: Check user not in core team - uses: tspascoal/get-user-teams-membership@v2 - id: teamAffiliation - with: + - name: Check if user is in team + id: check_team + env: GITHUB_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} - username: ${{ github.event.comment.user.login }} - team: ocf-core + USER: ${{ github.event.comment.user.login }} + run: | + is_member=$(gh api \ + -H "Accept: application/vnd.github+json" \ + /orgs/openclimatefix/teams/ocf-core/members \ + --jq ".[] | select(.login == \"${USER}\") | .login") + + if [[ -n "$is_member" ]]; then + echo "is_member=true" >> "$GITHUB_OUTPUT" + else + echo "is_member=false" >> "$GITHUB_OUTPUT" + fi - name: Add comment - if: ${{ steps.teamAffiliation.outputs.isTeamMember == 'false' }} + if: ${{ steps.check_team.outputs.is_member == 'false' }} run: | gh issue comment "$NUMBER" --body "@${{ github.event.comment.user.login }} $BODY" env: From be4fccd14f1e917642c2ff5a4894a1e0a0b5d65f Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Fri, 16 Jan 2026 16:48:07 +0000 Subject: [PATCH 5/6] Update tokens --- .github/workflows/internal-issue-comment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml index e57058e..4988619 100644 --- a/.github/workflows/internal-issue-comment.yml +++ b/.github/workflows/internal-issue-comment.yml @@ -16,7 +16,7 @@ jobs: - name: Check if user is in team id: check_team env: - GITHUB_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} + GH_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} USER: ${{ github.event.comment.user.login }} run: | is_member=$(gh api \ @@ -34,7 +34,7 @@ jobs: run: | gh issue comment "$NUMBER" --body "@${{ github.event.comment.user.login }} $BODY" env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} GH_REPO: ${{ github.repository }} NUMBER: ${{ github.event.issue.number }} BODY: > From e51a016908c97b8df0b57786ce9469e39185d0b2 Mon Sep 17 00:00:00 2001 From: Alexandra Udaltsova <43303448+AUdaltsova@users.noreply.github.com> Date: Tue, 20 Jan 2026 10:37:55 +0000 Subject: [PATCH 6/6] Remove unused variable --- .github/workflows/internal-issue-comment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/internal-issue-comment.yml b/.github/workflows/internal-issue-comment.yml index 4988619..7fe32f3 100644 --- a/.github/workflows/internal-issue-comment.yml +++ b/.github/workflows/internal-issue-comment.yml @@ -35,7 +35,6 @@ jobs: gh issue comment "$NUMBER" --body "@${{ github.event.comment.user.login }} $BODY" env: GH_TOKEN: ${{ secrets.OCF_BOT_PAT_TOKEN }} - GH_REPO: ${{ github.repository }} NUMBER: ${{ github.event.issue.number }} BODY: > Thank you for reaching out! Unfortunately, this issue is not suitable for open source