Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/gsoc-issues-auto-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: gsoc-issues-auto-close

on:
issues:
types: [opened]

jobs:
close-untemplated-issue:
if: >
contains(fromJSON('["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "NONE"]'), github.event.issue.author_association) &&
!contains(github.event.issue.body, 'Environment (`conda list`)') &&
!contains(github.event.issue.body, '**Is your feature request related to a problem? Please describe.**')
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
BODY: |
👋 Welcome @${{ github.event.issue.user.login }}! Thank you for opening an issue in this repository!

Since this issue doesn't follow one of our issue templates, we are assuming this is a Google Summer of Code issue and hence closing it.

If you don't know what Google Summer of Code is and aren't applying to it, please open a new issue using one of the templates.

If you are planning to apply to the program please don't open a new issue, we don't have the capacity to review Google Summer of Code issues at the moment.
steps:
- run: gh issue close "$NUMBER" --repo "$GITHUB_REPOSITORY" --comment "$BODY"
29 changes: 0 additions & 29 deletions .github/workflows/mailmap.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/publish-mailmap.yml

This file was deleted.

62 changes: 49 additions & 13 deletions .github/workflows/util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,53 @@ name: utility

on:
pull_request_target:
types: [opened]
branches:
- master
workflow_run:
workflows: [mailmap]
types: [completed]

# pull_request_target runs with secrets, so no job checks out or runs PR code.
permissions:
contents: read
issues: read
pull-requests: read

jobs:
mailmap:
runs-on: ubuntu-latest
steps:
- name: Check PR authors
env:
GH_TOKEN: ${{ github.token }}
NUMBER: ${{ github.event.pull_request.number }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
authors=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$NUMBER/commits" --paginate --jq '.[].commit.author | "\(.name) <\(.email)>"')
gh api "repos/$HEAD_REPO/contents/.mailmap?ref=$HEAD_SHA" -H 'Accept: application/vnd.github.raw' | grep -F "$authors" || {
echo "Committer name or email couldn't be found in .mailmap"
echo "$authors"
exit 1
}

comment-on-mailmap-failure:
needs: mailmap
if: failure()
runs-on: ubuntu-latest
steps:
- uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
*\*beep\* \*bop\**

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your **name** and **email** to `.mailmap` in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow [this example](https://docs.enterprise.codescene.io/versions/2.0.0/getting-started/ensure-you-use-a-mailmap.html).

resolve-pull-request:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -44,7 +83,7 @@ jobs:
close-gsoc-pull-request:
needs: resolve-pull-request
if: >
github.event_name == 'pull_request_target' &&
github.event.action == 'opened' &&
contains(fromJSON('["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "NONE"]'), needs.resolve-pull-request.outputs.association) &&
needs.resolve-pull-request.outputs.gsoc == 'true'
runs-on: ubuntu-latest
Expand All @@ -68,13 +107,12 @@ jobs:
- run: gh pr close "$NUMBER" --repo "$GITHUB_REPOSITORY"

close-missing-mailmap-entry:
needs: resolve-pull-request
needs: [resolve-pull-request, mailmap]
if: >
github.event_name == 'workflow_run' &&
failure() &&
needs.resolve-pull-request.outputs.number != '' &&
contains(fromJSON('["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "NONE"]'), needs.resolve-pull-request.outputs.association) &&
needs.resolve-pull-request.outputs.gsoc == 'false' &&
github.event.workflow_run.conclusion == 'failure'
needs.resolve-pull-request.outputs.gsoc == 'false'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
Expand Down Expand Up @@ -104,13 +142,11 @@ jobs:
run: gh pr close "$NUMBER" --repo "$GITHUB_REPOSITORY"

welcome-first-time-contributor:
needs: resolve-pull-request
needs: [resolve-pull-request, mailmap]
if: >
github.event_name == 'workflow_run' &&
needs.resolve-pull-request.outputs.number != '' &&
contains(fromJSON('["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "NONE"]'), needs.resolve-pull-request.outputs.association) &&
needs.resolve-pull-request.outputs.gsoc == 'false' &&
github.event.workflow_run.conclusion == 'success'
needs.resolve-pull-request.outputs.gsoc == 'false'
runs-on: ubuntu-latest
steps:
- uses: peter-evans/find-comment@v3
Expand Down
3 changes: 0 additions & 3 deletions docs/current_developers/continuous_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ The following pairs use this setup:
* - ``compare-regdata``
- ``publish-regdata-comparison``
- Regression-data comparison page and comment
* - ``mailmap``
- ``publish-mailmap``
- Failure guidance comment
* - ``orcid-check``
- ``publish-orcid``
- Missing-ORCID guidance comment
Expand Down
Loading