Skip to content
Closed
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
38 changes: 25 additions & 13 deletions .github/workflows/notify_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const endpoint = "GET /repos/:owner/:repo/actions/workflows/:id/runs?&branch=:branch"
// TODO: Should use pull_request.user and pull_request.user.repos_url?
// If a different person creates a commit to another forked repo,
// it would be able to detect.
const params = {
owner: context.payload.pull_request.head.repo.owner.login,
repo: context.payload.pull_request.head.repo.name,
Expand All @@ -22,19 +25,28 @@ jobs:
}

const runs = await github.request(endpoint, params)
var runID = runs.data.workflow_runs[0].id
const runID = runs.data.workflow_runs[0].id
const runUrl = "https://github.com/"
+ context.payload.pull_request.head.repo.full_name
+ "/actions/runs/"
+ runID

var msg = "**[Test build #" + runID + "]"
+ "(https://github.com/" + context.payload.pull_request.head.repo.full_name
+ "/actions/runs/" + runID + ")** "
+ "for PR " + context.issue.number
+ " at commit [`" + context.payload.pull_request.head.sha.substring(0, 7) + "`]"
+ "(https://github.com/" + context.payload.pull_request.head.repo.full_name
+ "/commit/" + context.payload.pull_request.head.sha + ")."
const name = 'Build and test'
const head_sha = context.payload.pull_request.head.sha
const status = 'in_progress'

github.issues.createComment({
issue_number: context.issue.number,
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
body: msg
github.checks.create({
...context.repo,
name,
head_sha,
status,
output: {
title: 'Build and test',
summary: runUrl,
text: JSON.stringify({
owner: context.payload.pull_request.head.repo.owner.login,
repo: context.payload.pull_request.head.repo.name,
run_id: runID
})
}
})
52 changes: 52 additions & 0 deletions .github/workflows/update_build_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update build status workflow

on:
pull_request_target:
types: [opened, reopened, synchronize]

jobs:
stale:
runs-on: ubuntu-20.04
steps:
- name: "Update build status"
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const endpoint = "GET /repos/:owner/:repo/pulls?state=:state"
const params = {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
}

const maybeReady = ["clean", "has_hooks", "unknown", "unstable"];
const notReady = ["dirty", "draft"];

for await (const prs of client.paginate.iterator(endpoint,params)) {
const prs = prs.data.filter(pr => {
console.log("Mergeable state:" + pr.mergeable_state);
if (pr.mergeable_state == null || maybeReady.includes(pr.mergeable_state)) {
const checkRuns = await github.request('GET /repos/{owner}/{repo}/commits/{ref}/check-runs', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: pr.head.sha
})

if (checkRuns[0].name == "Build and test" && checkRuns[0].status == "in_progress") {
const params = JSON.parse(checkRuns[0].output.text) // text contains parameters to make request in JSON
const { conclusion } = await github.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}', params)

if (conclusion == "success" || conclusion == "failure") {
await github.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', {
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: checkRuns[0].id,
status: 'completed',
conclusion: conclusion
})
}
}
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Apache Spark

Spark is a unified analytics engine for large-scale data processing. It provides
Apache Spark is a unified analytics engine for large-scale data processing. It provides
high-level APIs in Scala, Java, Python, and R, and an optimized engine that
supports general computation graphs for data analysis. It also supports a
rich set of higher-level tools including Spark SQL for SQL and DataFrames,
Expand Down