ci: Added test to validated Github output

releases/v3
Tycho Bokdam 2022-11-09 18:18:33 +01:00
parent e36f42c737
commit 42c39e3751
No known key found for this signature in database
GPG Key ID: F1180857DB997467
2 changed files with 44 additions and 0 deletions

View File

@ -6,6 +6,40 @@ on:
- releases/*
jobs:
test-github-output:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit --allow-empty -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
EXPECTED_TAG: 'v1.5.0'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file.json'
- name: Show file
run: |
echo "$(<test-file.json)"
- name: Test output
run: node ./test-github-output.js
env:
TAG: ${{ steps.changelog.outputs.tag }}
EXPECTED_TAG: '1.5.0'
test-json:
runs-on: ubuntu-latest
steps:

View File

@ -0,0 +1,10 @@
const assert = require('assert')
const {
TAG,
EXPECTED_TAG,
} = process.env
console.log(`Got tag "${TAG}"`)
assert.strictEqual(TAG, EXPECTED_TAG, 'Tag does not match what is expected')