mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
feat: Validate GitHub Actions schema (#2416)
* feat: Validate GitHub Actions schema **BREAKING** previously accepted workflows are now invalid * update code * fix tests * Bump docker / fix lint * fix test action due to moving the file * remove unused function * fix parsing additional functions * fix allow int * update docker dep, due to linter (cherry picked from commit 64219df0f2155d75ffc4423dc93c1e80bb4740bc) Conflicts: go.mod go.sum pkg/model/workflow.go trivial context conflict & go.mod upgrades
This commit is contained in:
parent
7eb547faa5
commit
65ae238f17
10 changed files with 2847 additions and 66 deletions
|
@ -1,44 +1,44 @@
|
|||
inputs:
|
||||
who-to-greet:
|
||||
default: 'Mona the Octocat'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# Test if GITHUB_ACTION_PATH is set correctly before all steps
|
||||
- run: stat $GITHUB_ACTION_PATH/push.yml
|
||||
shell: bash
|
||||
- run: stat $GITHUB_ACTION_PATH/action.yml
|
||||
shell: bash
|
||||
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
|
||||
shell: bash
|
||||
- uses: ./actions/docker-local
|
||||
id: dockerlocal
|
||||
with:
|
||||
who-to-greet: ${{inputs.who-to-greet}}
|
||||
- run: '[[ "${{ env.SOMEVAR }}" == "${{inputs.who-to-greet}}" ]]'
|
||||
shell: bash
|
||||
- run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1'
|
||||
shell: bash
|
||||
env:
|
||||
SOMEVAR: 'Not Mona'
|
||||
- run: '[[ "${{ steps.dockerlocal.outputs.whoami }}" == "${{inputs.who-to-greet}}" ]]'
|
||||
shell: bash
|
||||
# Test if overriding args doesn't leak inputs
|
||||
- uses: ./actions/docker-local-noargs
|
||||
with:
|
||||
args: ${{format('"{0}"', 'Mona is not the Octocat') }}
|
||||
who-to-greet: ${{inputs.who-to-greet}}
|
||||
- run: '[[ "${{ env.SOMEVAR }}" == "Mona is not the Octocat" ]]'
|
||||
shell: bash
|
||||
- uses: ./localdockerimagetest_
|
||||
# Also test a remote docker action here
|
||||
- uses: actions/hello-world-docker-action@v1
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
# Test if GITHUB_ACTION_PATH is set correctly after all steps
|
||||
- run: stat $GITHUB_ACTION_PATH/push.yml
|
||||
shell: bash
|
||||
- run: stat $GITHUB_ACTION_PATH/action.yml
|
||||
shell: bash
|
||||
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
|
||||
shell: bash
|
||||
inputs:
|
||||
who-to-greet:
|
||||
default: 'Mona the Octocat'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# Test if GITHUB_ACTION_PATH is set correctly before all steps
|
||||
- run: stat $GITHUB_ACTION_PATH/../push.yml
|
||||
shell: bash
|
||||
- run: stat $GITHUB_ACTION_PATH/action.yml
|
||||
shell: bash
|
||||
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
|
||||
shell: bash
|
||||
- uses: ./actions/docker-local
|
||||
id: dockerlocal
|
||||
with:
|
||||
who-to-greet: ${{inputs.who-to-greet}}
|
||||
- run: '[[ "${{ env.SOMEVAR }}" == "${{inputs.who-to-greet}}" ]]'
|
||||
shell: bash
|
||||
- run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1'
|
||||
shell: bash
|
||||
env:
|
||||
SOMEVAR: 'Not Mona'
|
||||
- run: '[[ "${{ steps.dockerlocal.outputs.whoami }}" == "${{inputs.who-to-greet}}" ]]'
|
||||
shell: bash
|
||||
# Test if overriding args doesn't leak inputs
|
||||
- uses: ./actions/docker-local-noargs
|
||||
with:
|
||||
args: ${{format('"{0}"', 'Mona is not the Octocat') }}
|
||||
who-to-greet: ${{inputs.who-to-greet}}
|
||||
- run: '[[ "${{ env.SOMEVAR }}" == "Mona is not the Octocat" ]]'
|
||||
shell: bash
|
||||
- uses: ./localdockerimagetest_
|
||||
# Also test a remote docker action here
|
||||
- uses: actions/hello-world-docker-action@v1
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
# Test if GITHUB_ACTION_PATH is set correctly after all steps
|
||||
- run: stat $GITHUB_ACTION_PATH/../push.yml
|
||||
shell: bash
|
||||
- run: stat $GITHUB_ACTION_PATH/action.yml
|
||||
shell: bash
|
||||
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
|
||||
shell: bash
|
|
@ -6,4 +6,4 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./local-action-via-composite-dockerfile
|
||||
- uses: ./local-action-via-composite-dockerfile/action
|
Loading…
Add table
Add a link
Reference in a new issue