Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.
Merged
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
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
- run: |
npm run all
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./
Expand Down
16 changes: 14 additions & 2 deletions dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/post.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import * as core from '@actions/core'
import {stopAgent} from './stop'
import {stopAgent, stopWindowsAgent} from './stop'

async function run(): Promise<void> {
try {
const containerName: string = core.getInput('container_name', {required: true})
core.info('Stopping agent')
const code = await stopAgent(containerName)

let code = 0
if (process.env['RUNNER_OS'] === 'Windows') {
code = await stopWindowsAgent(containerName)
} else {
code = await stopAgent(containerName)
}

if (code !== 0) throw new Error(`could not stop agent (${code})`)
core.info('Agent stopped')
} catch (error) {
Expand Down
4 changes: 4 additions & 0 deletions src/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import {exec} from '@actions/exec'
export async function stopAgent(containerName: string): Promise<number> {
return exec('docker', ['exec', '-t', containerName, 'agent', 'stop'])
}

export async function stopWindowsAgent(containerName: string): Promise<number> {
return exec('docker', ['exec', '-t', containerName, 'agent', 'stopservice'])
}