Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# GitHub Actions Continuous Integration workflows

- binder.yaml - Adds a Binder badge to Pull Requests that are newly opened
- build.yaml - Build and push docker container images to a docker registry
- conda-lock-command.yml - Refresh conda-lock files by writing `/condalock` in a Pull Request comment
- slash-command-dispatch.yml - ChatOps that looks for slash commands in Pull Requests to trigger automated scripts
- test.yaml - Test building docker container images in a Pull Request
69 changes: 69 additions & 0 deletions .github/workflows/conda-lock-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Runs conda-lock against environment.yml for reproducible environments
# Runs on any opened PR
name: Conda Lock

on:
repository_dispatch:
types: [condalock-command]

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
condalock:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
shell: bash -l {0}

steps:
# Generate token from CryoInTheCloud bot
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

# Checkout the pull request branch
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}

# Setup Python environment
- uses: actions/setup-python@v4
with:
python-version: '3.10'

# Install conda-lock library
- name: Install conda-lock
run: pip install conda-lock

# Run "conda-lock" for linux-64 only
- name: Run conda-lock
run: |
conda-lock lock --mamba --kind explicit --file environment.yml --platform linux-64

# Commit the change to the PR branch if any changes
- name: Commit condalock files to PR
run: |
if [[ $(git ls-files --modified --others) ]]; then
git config --global user.name 'actions-bot'
git config --global user.email '58130806+actions-bot@users.noreply.github.com'
git commit --all --message "[condalock-command] autogenerated conda-lock files"
git push
fi

# Add an emoji reaction to comment to indicate the script completed successfully
- name: Add reaction
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ steps.generate-token.outputs.token }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray
34 changes: 34 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Slash Command Dispatch

on:
issue_comment:
types: [created]
# Add "edited" type for test purposes. Where possible, avoid using to prevent processing unnecessary events.
# types: [created, edited]

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
slashCommandDispatch:
permissions:
pull-requests: write # for peter-evans/slash-command-dispatch to create PR reaction
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
# Generate token from CryoInTheCloud bot
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v3
with:
token: ${{ steps.generate-token.outputs.token }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
commands: |
condalock
issue-type: pull-request
permission: none
2 changes: 2 additions & 0 deletions conda-linux-64.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by conda-lock.
# platform: linux-64