Manual Workflow workflow (udacity/artificial-intelligence)
The Manual Workflow workflow from udacity/artificial-intelligence, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Manual Workflow workflow from the udacity/artificial-intelligence repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# Workflow to ensure whenever a Github PR is submitted,
# a JIRA ticket gets created automatically.
name: Manual Workflow
# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the master branch
pull_request_target:
types: [opened, reopened]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test-transition-issue:
name: Convert Github Issue to Jira Issue
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Login
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Create NEW JIRA ticket
id: create
uses: atlassian/gajira-create@master
with:
project: CONUPDATE
issuetype: Task
summary: |
Github PR [Assign the ND component] | Repo: ${{ github.repository }} | PR# ${{github.event.number}}
description: |
Repo link: https://github.com/${{ github.repository }}
PR no. ${{ github.event.pull_request.number }}
PR title: ${{ github.event.pull_request.title }}
PR description: ${{ github.event.pull_request.description }}
In addition, please resolve other issues, if any.
fields: '{"components": [{"name":"Github PR"}], "customfield_16449":"https://classroom.udacity.com/", "customfield_16450":"Resolve the PR", "labels": ["github"], "priority":{"id": "4"}}'
- name: Log created issue
run: echo "Issue ${{ steps.create.outputs.issue }} was created"
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Workflow to ensure whenever a Github PR is submitted, # a JIRA ticket gets created automatically. name: Manual Workflow # Controls when the action will run. on: # Triggers the workflow on pull request events but only for the master branch pull_request_target: types: [opened, reopened] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: test-transition-issue: timeout-minutes: 30 name: Convert Github Issue to Jira Issue runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@master - name: Login uses: atlassian/gajira-login@master env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - name: Create NEW JIRA ticket id: create uses: atlassian/gajira-create@master with: project: CONUPDATE issuetype: Task summary: | Github PR [Assign the ND component] | Repo: ${{ github.repository }} | PR# ${{github.event.number}} description: | Repo link: https://github.com/${{ github.repository }} PR no. ${{ github.event.pull_request.number }} PR title: ${{ github.event.pull_request.title }} PR description: ${{ github.event.pull_request.description }} In addition, please resolve other issues, if any. fields: '{"components": [{"name":"Github PR"}], "customfield_16449":"https://classroom.udacity.com/", "customfield_16450":"Resolve the PR", "labels": ["github"], "priority":{"id": "4"}}' - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created"
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.