Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init action #1

Merged
merged 81 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
04005c8
Init
rajbos Mar 13, 2023
d896946
Create
rajbos Mar 13, 2023
3e5c4e4
Update test-local-action.yml
rajbos Mar 13, 2023
2680b44
Update test-local-action.yml
rajbos Mar 13, 2023
42ad404
Update test-local-action.yml
rajbos Mar 13, 2023
0a0af5f
Update test-local-action.yml
rajbos Mar 13, 2023
97bb1b0
Create
rajbos Mar 13, 2023
7a7a12a
Delete reviewdog.yml
rajbos Mar 13, 2023
c4a6191
Create actionlint-matcher.json
rajbos Mar 13, 2023
1a3eb06
Update action.yml
rajbos Mar 13, 2023
5e6eeb6
Update action.yml
rajbos Mar 13, 2023
b04d783
Update action.yml
rajbos Mar 13, 2023
ae44d41
Update action.yml
rajbos Mar 13, 2023
cec88fe
Update action.yml
rajbos Mar 13, 2023
03ffd42
Update test-local-action.yml
rajbos Mar 13, 2023
62ab4d0
Update action.yml
rajbos Mar 13, 2023
715d59c
Update action.yml
rajbos Mar 13, 2023
9f6d499
Update action.yml
rajbos Mar 13, 2023
06d4928
Update action.yml
rajbos Mar 13, 2023
87761c8
Update action.yml
rajbos Mar 13, 2023
080c66f
Update action.yml
rajbos Mar 13, 2023
32b41fb
Update action.yml
rajbos Mar 13, 2023
1b66b62
Update action.yml
rajbos Mar 13, 2023
38bddfc
Update test-local-action.yml
rajbos Mar 13, 2023
cac6071
Update action.yml
rajbos Mar 13, 2023
34cf16a
Update action.yml
rajbos Mar 13, 2023
f0ede1b
Update action.yml
rajbos Mar 13, 2023
de4f343
Update action.yml
rajbos Mar 13, 2023
14746ba
Update action.yml
rajbos Mar 13, 2023
762dbfd
Update action.yml
rajbos Mar 13, 2023
5bc4df1
Update action.yml
rajbos Mar 13, 2023
73801bb
Update action.yml
rajbos Mar 13, 2023
1cd0acf
Update action.yml
rajbos Mar 13, 2023
86459f0
Update action.yml
rajbos Mar 13, 2023
b82c485
Update action.yml
rajbos Mar 13, 2023
f511c7e
Update action.yml
rajbos Mar 13, 2023
26798cc
Update test-local-action.yml
rajbos Mar 13, 2023
684daeb
Update test-local-action.yml
rajbos Mar 13, 2023
80bd437
Add expected error checking
rajbos Mar 13, 2023
946584d
Update action.yml
rajbos Mar 13, 2023
3160a9b
Update test-local-action.yml
rajbos Mar 13, 2023
1c7182b
Update action.yml
rajbos Mar 13, 2023
55188b9
Update test-local-action.yml
rajbos Mar 13, 2023
03988fe
Update action.yml
rajbos Mar 13, 2023
9a38b1f
Update action.yml
rajbos Mar 13, 2023
79cb4f1
Update action.yml
rajbos Mar 13, 2023
259c3ab
Update action.yml
rajbos Mar 13, 2023
5b866d7
Update action.yml
rajbos Mar 13, 2023
d04f3fa
Update test-local-action.yml
rajbos Mar 13, 2023
4be3d40
Update action.yml
rajbos Mar 13, 2023
3113542
Update action.yml
rajbos Mar 13, 2023
b608b83
Update action.yml
rajbos Mar 13, 2023
25fc201
Update action.yml
rajbos Mar 13, 2023
dd95258
Update action.yml
rajbos Mar 13, 2023
986a620
Update action.yml
rajbos Mar 13, 2023
c4a1bde
Update action.yml
rajbos Mar 13, 2023
298a1b8
Update action.yml
rajbos Mar 13, 2023
92058da
Create
rajbos Mar 13, 2023
44883f3
Update superlinter.yml
rajbos Mar 13, 2023
de39c5d
Update superlinter.yml
rajbos Mar 13, 2023
a915e10
Update superlinter.yml
rajbos Mar 13, 2023
7b444cd
Update superlinter.yml
rajbos Mar 13, 2023
58c6228
Update superlinter.yml
rajbos Mar 13, 2023
2a09f3f
Update superlinter.yml
rajbos Mar 13, 2023
7fa5f65
Update action.yml
rajbos Mar 13, 2023
9e95562
Update action.yml
rajbos Mar 13, 2023
d5cde42
Update action.yml
rajbos Mar 13, 2023
4004710
Update action.yml
rajbos Mar 13, 2023
2159916
Update action.yml
rajbos Mar 13, 2023
a5d70fb
Update action.yml
rajbos Mar 13, 2023
7098674
testing pipefail
rajbos Mar 13, 2023
1cc2c26
Fix quotes
rajbos Mar 13, 2023
1ba3c48
cleanup
rajbos Mar 13, 2023
7fed931
Building up again
rajbos Mar 13, 2023
2f587e5
cleanup
rajbos Mar 13, 2023
97be1b7
cleanup
rajbos Mar 13, 2023
f4f07d2
remove continue on error
rajbos Mar 13, 2023
d7354e5
skip continue on error
rajbos Mar 13, 2023
a49b7c4
test locally on PR
rajbos Mar 13, 2023
124266b
remove extra test log
rajbos Mar 13, 2023
db19e64
whoops
rajbos Mar 13, 2023
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
54 changes: 54 additions & 0 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
#################################
#################################
## Super Linter GitHub Actions ##
#################################
#################################
name: Lint Code Base

#############################
# Start the job on all push #
#############################
on:
push:
paths:
- .github/workflows/superlinter.yml
#pull_request:

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

permissions:
pull-requests: write
statuses: write

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72 changes: 72 additions & 0 deletions .github/workflows/test-local-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test local action
on:
push:

pull_request:

jobs:
test-local-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run the local action from the checked out branch
id: action-lint
uses: ./

- name: Check for no reported errors
if: steps.action-lint.outcome=='success'
run: |
echo "Error in 'action-lint' step, expeced a failure status, but got success"
# fail the job so reporting can pick it up
exit 1

- name: Check for expected errors
if: always() && steps.action-lint.outcome=='failure'
run: |
echo "Todo: check the results of fake-output and fake-secret"

- name: Test output file and expected contents
if: always()
shell: pwsh
env:
RESULTFILE: ${{ steps.action-lint.outputs.results-file }}
run: |
echo "Results file is [$env:RESULTFILE]"
$result = Get-Content $env:RESULTFILE
$items = @(ConvertFrom-Json $result -Depth 10)

$found1 = $false
foreach ($item in $items) {
Write-Host "Found an error: "
Write-Host "Message:" $item.message
Write-Host "Filepath:" $item.filepath
Write-Host "Line:" $item.line

if ($item.filepath -eq ".github/workflows/test-local-action.yml" -and $item.line -eq 63) {
$found1 = $true
}
}

if (!$found1){
echo "Error finding the first expected result. Exiting with failure"
exit 1
}
else {
Write-Host "Found the expected error succesfully"
}

job-with-errors:
runs-on: ubuntu-latest
steps:
- name: Non existing output
id: fake-output
run: |
echo "Let's echo an output that does not exist, should fail the check:"
echo "Output that does not exist: ${{ needs.test-with-local-action.outputs.fake-output }}"

- name: Non existing secret
id: fake-secret
run: |
echo "Let's echo a secret that does not exist, should fail the check:"
echo "Secret that does not exist: ${{ secrets.fake-secret }}"
37 changes: 37 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Rhysd actionlint
description: Check your workflows for common errors, like not declaring outputs before using them, bash script errors, and more!
branding:
icon: tag
color: gray-dark
outputs:
results-file:
description: "Path to the json results of the linter"
value: ${{ steps.run.outputs.resultsfile }}

runs:
using: composite
steps:
- name: Add anotation matcher
run: echo "::add-matcher::actionlint-matcher.json"
shell: bash

- name: Docker run
shell: bash
id: run
run: |
# running version 1.6.22 of rhysd/actionlint
# disable pipefail -e -o that is set on the shell script from the runner to prevent exiting when the docker run command fails
set +e +o pipefail;
result=$(docker run -v /home/runner/work/actionlint/actionlint:/repo --workdir /repo rhysd/actionlint@sha256:5f957b2a08d223e48133e1a914ed046bea12e578fe2f6ae4de47fdbe691a2468 -color -format "{{json .}}")
status=$?
#echo "Loaded status [$status]"
if [[ $status == 0 ]];
then
echo "actionlint had no errors"
else
echo "actionlint found errors"
fi
echo $result > "actionlint-errors.json"
echo "resultsfile=actionlint-errors.json" >> $GITHUB_OUTPUT

exit $status
17 changes: 17 additions & 0 deletions actionlint-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}