diff --git a/.github/actions/setup-docker/action.yml b/.github/actions/setup-docker/action.yml new file mode 100644 index 0000000..c4e1f7d --- /dev/null +++ b/.github/actions/setup-docker/action.yml @@ -0,0 +1,13 @@ +name: "Setup Docker" +description: "Use the local Dockerfile to test the action instead of the one on DockerHub" + +runs: + using: "composite" + steps: + - name: Replace image on action.yml + shell: bash + env: + ESC_DOCKER_IMAGE_LINK: 'docker\:\/\/sentryintegrations\/sentry-github-action-release\:latest' + run: | + mv action.yml previous.yml + sed "s/$ESC_DOCKER_IMAGE_LINK/Dockerfile/" previous.yml >> action.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 911a11a..be69a24 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ name: "test" -on: # rebuild any PRs and main branch changes +on: pull_request: push: branches: @@ -7,16 +7,14 @@ on: # rebuild any PRs and main branch changes - 'releases/*' jobs: - test: # make sure the action works on a clean machine without building + mock: # Make sure that the action works on a clean machine without building runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Create Sentry release + - uses: actions/checkout@v3 + - uses: './.github/actions/setup-docker' + - name: Mock creating a Sentry release uses: ./ env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} MOCK: true with: environment: production diff --git a/CONTRIBUTING b/CONTRIBUTING index ca4c742..c85e6fa 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -1,4 +1,4 @@ # Contributing Feel free to use GitHub's pull request features to propose changes. -See the [Code of Conduct](https://github.com/getsentry/.github/blob/master/CODE_OF_CONDUCT.md). +See the [Code of Conduct](https://github.com/getsentry/.github/blob/main/CODE_OF_CONDUCT.md). diff --git a/src/cli.ts b/src/cli.ts index e3831ae..2a8aa1a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -15,6 +15,14 @@ export const getCLI = (): SentryCliReleases => { if (!cli) { cli = new SentryCli().releases; if (process.env['MOCK']) { + // Set environment variables if they aren't already + for (const variable of [ + 'SENTRY_AUTH_TOKEN', + 'SENTRY_ORG', + 'SENTRY_PROJECT', + ]) + !(variable in process.env) && (process.env[variable] = variable); + cli.execute = async ( args: string[], // eslint-disable-next-line @typescript-eslint/no-unused-vars