fix(ci): Repair CI for OS contributors (#91)

This PR fixes the CI workflow to generate values for environment variables if the MOCK env var is set. Previously the values needed to be set on the repository which works as well, but exists outside the code and elevated permissions to just run CI (meaning OS contributions would fail CI).

This behaviour is fine since it doesn't actually use these variables as network requests are stubbed when MOCK is set.

This was achieved by using the current repo for generating an image, rather than the published version. If the local image passes all tests and has been reviewed, it makes sense for it to be published afterward. Testing changes in this repo against the published version prevents testing new behaviour.
This commit is contained in:
Leander Rodrigues
2022-06-22 17:29:12 -07:00
committed by GitHub
parent bb1b02b9de
commit d53da5fece
4 changed files with 27 additions and 8 deletions
+13
View File
@@ -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
+5 -7
View File
@@ -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
+1 -1
View File
@@ -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).
+8
View File
@@ -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