Skip to content

Commit

Permalink
fix svenstaro#42 - overwrite body and name as well
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr committed May 22, 2023
1 parent fa31978 commit ea2866e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
asset_name: TEST.md
tag: ci-test-${{ matrix.os }}-${{ github.run_id }}
overwrite: true
promote: true
prerelease: true
make_latest: true
body: "rofl lol test%0Aianal %25 fubar"
Expand All @@ -54,6 +53,38 @@ jobs:
assert.deepStrictEqual(release.data.assets[0].name, "TEST.md")
const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`)
assert.deepStrictEqual(expected, actual)
- name: Make test promote
uses: ./
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
asset_name: TEST.md
tag: ci-test-${{ matrix.os }}-${{ github.run_id }}
overwrite: true
promote: true
prerelease: false
make_latest: true
body: "new body"
- name: Check that the release is promoted
uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs')
const child_process = require('child_process');
const assert = require('assert').strict;
const expected = fs.readFileSync("README.md")
const release = await github.repos.getReleaseByTag({
...context.repo,
tag: "ci-test-${{ matrix.os }}-${{ github.run_id }}",
})
assert.deepStrictEqual(release.data.prerelease, false)
assert.deepStrictEqual(release.data.make_latest, true)
assert.deepStrictEqual(release.data.body, "new body")
assert.deepStrictEqual(release.data.assets[0].name, "TEST.md")
const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`)
assert.deepStrictEqual(expected, actual)
- name: Clean up
if: ${{ always() }}
uses: actions/github-script@v2
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inputs:
asset_name:
description: 'Name of the asset. When not provided will use the file name. Unused if file_glob is set to "true".'
overwrite:
description: 'Overwrite the assets/name/body in case the release already exists.'
description: 'Overwrite the release in case it already exists.'
promote:
description: 'Promote a prerelease to release'
file_glob:
Expand Down

0 comments on commit ea2866e

Please sign in to comment.