Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Informing sentry about the latest release tag #122

Open
altjx opened this issue Dec 21, 2022 · 1 comment
Open

Informing sentry about the latest release tag #122

altjx opened this issue Dec 21, 2022 · 1 comment

Comments

@altjx
Copy link

altjx commented Dec 21, 2022

According to the documentation, it appears that it's possible to include the release tag when informing Sentry, but only if the PR is triggered via a release, is that correct?

In my case, I am creating a PR by another GitHub Workflow (not a release), and so I'm trying to determine a workaround with informing Sentry about the latest release tag version.

Here's what I have thus far:

  inform_sentry_about_release:
    runs-on: ubuntu-latest
    env:
      ACCESS_TOKEN: ${{ secrets.GH_PAT }}
    steps:
      - uses: actions/checkout@v2
      - name: Set GITHUB_VERSION variable
        run: |
          echo 'GITHUB_LATEST_RELEASE=$(curl -H "Authorization: token ${ACCESS_TOKEN}" "https://api.github.com/repos/myusername/myreponame/releases" -s | jq -r ".[0].tag_name")' >> $GITHUB_ENV
      - name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
          SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
        with:
          environment: production
          version: ${{ GITHUB_LATEST_RELEASE }}

The problem is that the workflow fails here:

The workflow is not valid. .github/workflows/production-label.yml (Line: 131, Col: 20): Unrecognized named-value: 'GITHUB_LATEST_RELEASE'. Located at position 1 within expression: GITHUB_LATEST_RELEASE

which is referring to this:

version: ${{ GITHUB_LATEST_RELEASE }}

Is there a way to simply inform Sentry about the latest release tag without having to do all of this, or at least a way to utilize an environment variable that should be set from the previous step?

@lewislbr
Copy link

Try accessing the created variable as ${{ env.GITHUB_LATEST_RELEASE }}. Notice the env. prefix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants