diff --git a/README.md b/README.md index 68ce67061..913cbcc67 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,17 @@ jobs: update_release_draft: runs-on: ubuntu-latest steps: + # (Optional) GitHub Enterprise requires GHE_HOST variable set + #- name: Set GHE_HOST + # run: | + # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + # Drafts your next Release notes as Pull Requests are merged into "master" - uses: release-drafter/release-drafter@v5 # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml # with: # config-name: my-config.yml + # disable-autolabeler: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` diff --git a/action.yml b/action.yml index ef5234ade..69fb76b28 100644 --- a/action.yml +++ b/action.yml @@ -35,7 +35,7 @@ inputs: default: '' prerelease: description: | - A boolean indicating whether the relase being created or updated is a prerelease. + A boolean indicating whether the release being created or updated is a prerelease. required: false default: '' commitish: @@ -43,6 +43,16 @@ inputs: The object that the release should be created to point to. required: false default: '' + disable-releaser: + description: | + A boolean indicating whether the releaser mode is disabled. + required: false + default: '' + disable-autolabeler: + description: | + A boolean indicating whether the autolabeler mode is disabled. + required: false + default: '' outputs: id: description: The ID of therelease that was created or updated. diff --git a/dist/index.js b/dist/index.js index e7d6f1ba0..024aaf4e3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -66,12 +66,14 @@ module.exports = (app, { getRouter }) => { 'pull_request.synchronize', ], async (context) => { + const { disableAutolabeler } = getInput() + const config = await getConfig({ context, configName: core.getInput('config-name'), }) - if (config === null) return + if (config === null || disableAutolabeler) return let issue = { ...context.issue({ pull_number: context.payload.pull_request.number }), @@ -159,7 +161,14 @@ module.exports = (app, { getRouter }) => { ) app.on(event, async (context) => { - const { shouldDraft, configName, version, tag, name } = getInput() + const { + shouldDraft, + configName, + version, + tag, + name, + disableReleaser, + } = getInput() const config = await getConfig({ context, @@ -168,7 +177,7 @@ module.exports = (app, { getRouter }) => { const { isPreRelease } = getInput({ config }) - if (config === null) return + if (config === null || disableReleaser) return // GitHub Actions merge payloads slightly differ, in that their ref points // to the PR branch instead of refs/heads/master @@ -244,6 +253,10 @@ function getInput({ config } = {}) { version: core.getInput('version') || undefined, tag: core.getInput('tag') || undefined, name: core.getInput('name') || undefined, + disableReleaser: + core.getInput('disable-releaser').toLowerCase() === 'true', + disableAutolabeler: + core.getInput('disable-autolabeler').toLowerCase() === 'true', } } diff --git a/index.js b/index.js index 8aa38589a..75813873e 100644 --- a/index.js +++ b/index.js @@ -29,12 +29,14 @@ module.exports = (app, { getRouter }) => { 'pull_request.synchronize', ], async (context) => { + const { disableAutolabeler } = getInput() + const config = await getConfig({ context, configName: core.getInput('config-name'), }) - if (config === null) return + if (config === null || disableAutolabeler) return let issue = { ...context.issue({ pull_number: context.payload.pull_request.number }), @@ -122,7 +124,14 @@ module.exports = (app, { getRouter }) => { ) app.on(event, async (context) => { - const { shouldDraft, configName, version, tag, name } = getInput() + const { + shouldDraft, + configName, + version, + tag, + name, + disableReleaser, + } = getInput() const config = await getConfig({ context, @@ -131,7 +140,7 @@ module.exports = (app, { getRouter }) => { const { isPreRelease } = getInput({ config }) - if (config === null) return + if (config === null || disableReleaser) return // GitHub Actions merge payloads slightly differ, in that their ref points // to the PR branch instead of refs/heads/master @@ -207,6 +216,10 @@ function getInput({ config } = {}) { version: core.getInput('version') || undefined, tag: core.getInput('tag') || undefined, name: core.getInput('name') || undefined, + disableReleaser: + core.getInput('disable-releaser').toLowerCase() === 'true', + disableAutolabeler: + core.getInput('disable-autolabeler').toLowerCase() === 'true', } }