forked from nektos/act
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: run all composite post actions in a step
Since composite actions could have multiple pre/post steps inside, we need to run all of them in a single top-level pre/post step. This PR includes a test case for this and the correct order of steps to be executed.
- Loading branch information
1 parent
34d96de
commit a927489
Showing
10 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...unner/testdata/uses-composite-with-pre-and-post-steps/action-with-pre-and-post/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "Action with pre and post" | ||
description: "Action with pre and post" | ||
|
||
inputs: | ||
step: | ||
description: "step" | ||
required: true | ||
|
||
runs: | ||
using: "node16" | ||
pre: pre.js | ||
main: main.js | ||
post: post.js |
4 changes: 4 additions & 0 deletions
4
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/action-with-pre-and-post/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { appendFileSync } = require('fs'); | ||
const env = process.env['STEP_OUTPUT_TEST']; | ||
const step = process.env['INPUT_STEP']; | ||
appendFileSync(process.env['GITHUB_ENV'], `;${step}`, { encoding:'utf-8' }) |
4 changes: 4 additions & 0 deletions
4
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/action-with-pre-and-post/post.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { appendFileSync } = require('fs'); | ||
const env = process.env['STEP_OUTPUT_TEST']; | ||
const step = process.env['INPUT_STEP']; | ||
appendFileSync(process.env['GITHUB_ENV'], `;${step}-post`, { encoding:'utf-8' }) |
1 change: 1 addition & 0 deletions
1
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/action-with-pre-and-post/pre.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('pre'); |
12 changes: 12 additions & 0 deletions
12
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/composite_action/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: "Test Composite Action" | ||
description: "Test action uses composite" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: ./uses-composite-with-pre-and-post-steps/action-with-pre-and-post | ||
with: | ||
step: step1 | ||
- uses: ./uses-composite-with-pre-and-post-steps/action-with-pre-and-post | ||
with: | ||
step: step2 |
7 changes: 7 additions & 0 deletions
7
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/last-action/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "last action check" | ||
description: "last action check" | ||
|
||
runs: | ||
using: "node16" | ||
main: main.js | ||
post: post.js |
Empty file.
7 changes: 7 additions & 0 deletions
7
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/last-action/post.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const output = process.env['STEP_OUTPUT_TEST']; | ||
const expected = 'empty;step1;step2;step2-post;step1-post'; | ||
|
||
console.log(output); | ||
if (output !== expected) { | ||
throw new Error(`Expected '${expected}' but got '${output}'`); | ||
} |
11 changes: 11 additions & 0 deletions
11
pkg/runner/testdata/uses-composite-with-pre-and-post-steps/push.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: uses-composite-with-pre-and-post-steps | ||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ./uses-composite-with-pre-and-post-steps/last-action | ||
- uses: actions/checkout@v2 | ||
- run: echo -n "STEP_OUTPUT_TEST=empty" >> $GITHUB_ENV | ||
- uses: ./uses-composite-with-pre-and-post-steps/composite_action |