NorseGaud
NorseGaud

Reputation: 771

How do I hook and execute cleanup commands in a GitHub Action when someone cancels the job?

I'm creating an action (using actions/javascript-actions) that creates something and then needs to clean up that something should someone cancel the job halfway.

I'm having trouble finding how to hook into pre-exit/cancel and do cleanup actions. Is this possible? Does anyone have any suggestions on achieving this?

Upvotes: 4

Views: 1918

Answers (1)

NorseGaud
NorseGaud

Reputation: 771

Finally figured it out. actions/checkout is a great example of the post "runs" to achieve this.

runs:
  using: node12
  main: dist/index.js
  post: dist/index.js

Upvotes: 3

Related Questions