Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Commit

Permalink
Skip updated manifest support for Excavator (#28)
Browse files Browse the repository at this point in the history
* Log files from PR

* Add rooster for forked repositories

* typo

* comment

* Readme

* Reorganize events

* Backbone

* Comments and logs

* Support SKIP_UPDATED for excavator

This will reduce log output

* No need for [bool] cast
  • Loading branch information
Ash258 authored Jul 4, 2019
1 parent 5e5411d commit b2bf1d3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
28 changes: 23 additions & 5 deletions Entrypoint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ function Initialize-Scheduled {
'Push' = $true
}
if ($env:SPECIAL_SNOWFLAKES) { $params.Add('SpecialSnowflakes', ($env:SPECIAL_SNOWFLAKES -split ',')) }
if ($env:SKIP_UPDATED) { $params.Add('SkipUpdated', $true) }

& "$env:SCOOP_HOME\bin\auto-pr.ps1" @params
# TODO: Post some comment??
Expand All @@ -378,27 +379,41 @@ function Initialize-PR {
exit 0
}

<#TODO: Handle cloning of forked repository
$head = $EVENT.pull_request.head
if ($head.repo.fork) { $REPOSITORY_forked = "$($head.repo.full_name):$($head.ref)" }
$cloneLocation = '/github/forked_workspace'
git clone --branch $head.ref $head.repo.clone_url $cloneLocation
$BUCKET_ROOT = $cloneLocation
Push-Location $cloneLocation
$MANIFESTS_LOCATION = if (Test-Path (Join-Path $BUCKET_ROOT 'bucket')) { Join-Path $BUCKET_ROOT 'bucket' } else { $BUCKET_ROOT }
#>

Get-Location

Write-log 'Files in PR:'

Get-ChildItem $BUCKET_ROOT
Get-ChildItem $MANIFESTS_LOCATION

$checks = @()
$prID = $EVENT.number
# Do not run on removed files
$files = Get-AllChangedFilesInPR $prID -Filter
# $message = @()
$checks = @()
Write-Log $files

foreach ($file in $files) {
Write-Log "Starting $($file.filename) checks"

# Convert path into gci item to hold all needed information
# TODO: Resolve root of PR
$manifest = Get-ChildItem $BUCKET_ROOT $file.filename
$object = Get-Content $manifest -Raw | ConvertFrom-Json
$statuses = [Ordered] @{ }

#region Property checks
$statuses.Add('Description', ([bool] $object.description))
# TODO: More advanced license checks
$statuses.Add('License', ([bool] $object.license))
#endregion Property checks

Expand All @@ -416,7 +431,6 @@ function Initialize-PR {

#region Checkver
Write-Log 'Checkver'
# TODO: Autoupdate
$outputV = @(& "$env:SCOOP_HOME\bin\checkver.ps1" -App $manifest.Basename -Dir $MANIFESTS_LOCATION -Force *>&1)
Write-log $outputV

Expand All @@ -429,7 +443,11 @@ function Initialize-PR {

#region formatjson
Write-Log 'Format'
# TODO:
# TODO: implement format check using array compare if possible (or just strings with raws)
# TODO: I am not sure if this will handle tabs and everything what could go wrong.
#$raw = Get-Content $manifest.Fullname -Raw
#$new_raw = $object | ConvertToPrettyJson
#$statuses.Add('Format', ($raw -eq $new_raw))
Write-Log 'Format done'
#endregion formatjson

Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗ DO NOT USE YET. Wait for 1.0 tag releae ❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗
<p align="center">
❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗ DO NOT USE YET. Wait for 1.0.0 tag release ❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗❗
</p>

You could participate in testing using `@stable` version or any of already released tags from release page.

# Github actions for scoop buckets

Expand Down Expand Up @@ -66,7 +70,7 @@ workflow "Excavator" {
}
action "IssueHandler" {
uses = "Ash258/Scoop-GithubActions@master"
uses = "Ash258/Scoop-GithubActions@stable"
args = "Issue"
env = {
"GITH_EMAIL" = "youremail@email.com" # Email is needed for pushing to repository within action container
Expand All @@ -75,7 +79,7 @@ action "IssueHandler" {
}
action "PullRequestHandler" {
uses = "Ash258/Scoop-GithubActions@master"
uses = "Ash258/Scoop-GithubActions@stable"
args = "PR"
env = {
"GITH_EMAIL" = "youremail@email.com"
Expand All @@ -84,10 +88,11 @@ action "PullRequestHandler" {
}
action "Excavate" {
uses = "Ash258/Scoop-GithubActions@master"
uses = "Ash258/Scoop-GithubActions@stable"
args = "Scheduled"
env = {
"SPECIAL_SNOWFLAKES" = "curl,brotli,jx" # Optional parameter,
"SPECIAL_SNOWFLAKES" = "curl,brotli,jx" # Optional parameter
"SKIP_UPDATED" = "1" # Optional parameter, Could be anything as value
"GITH_EMAIL" = "youremail@email.com"
}
secrets = ["GITHUB_TOKEN"]
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit b2bf1d3

Please sign in to comment.