September data #74
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Yeast genealogy preview | |
# Branch genealogy-preview must exist for this action to work. | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
jobs: | |
build_plots_and_publish: | |
if: "! github.event.pull_request.head.repo.fork " # If pull request is Not from Fork | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Graphviz | |
run: sudo apt-get install -y graphviz | |
- name: Wait for other instances to complete | |
uses: softprops/turnstyle@v1 | |
with: | |
poll-interval-seconds: 10 | |
- name: Generate, Commit and Push genealogy plot | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git fetch | |
cargo run --verbose | |
cat genealogy.dot | dot -Tpng > genealogy.png | |
cp genealogy.png ../genealogy.png | |
git restore . | |
git switch genealogy-preview | |
cp ../genealogy.png genealogy-${COMMIT_SHA}.png | |
git add genealogy-${COMMIT_SHA}.png | |
git commit --allow-empty -m "Yeast genealogy preview action" | |
git push origin HEAD:genealogy-preview | |
- name: Publish genealogy plot | |
run: | | |
IMAGE_URL="https://raw.githubusercontent.com/${{ github.repository }}/genealogy-preview/genealogy-${COMMIT_SHA}.png" | |
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${COMMIT_SHA}" | |
COMMENT="Building using data from commit [${COMMIT_SHA}](${COMMIT_URL})\nGenerated image: [${IMAGE_URL}](${IMAGE_URL})\n![Generated Image](${IMAGE_URL})" | |
COMMENT_URL=$(jq -r .pull_request.comments_url "$GITHUB_EVENT_PATH") | |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -X POST --data "{\"body\": \"$COMMENT\"}" "$COMMENT_URL" |