-
Notifications
You must be signed in to change notification settings - Fork 486
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
fix: make GITHUB_REF env var optional #82
fix: make GITHUB_REF env var optional #82
Conversation
* master: chore: Update dist fix: Make tagging optional (#92) chore: Bump eslint from 7.3.1 to 7.4.0 (#94) chore: Update dist chore: Bump aws-sdk from 2.707.0 to 2.708.0 (#90) chore: update dependabot schedule (#89) chore(release): 1.4.2 chore: Update dist chore: Bump aws-sdk from 2.706.0 to 2.707.0 (#88) chore: Switch to GitHub-native Dependabot chore: Update dist chore: Bump aws-sdk from 2.704.0 to 2.706.0 chore: Update dist fix: add comma to set of special characters (#78) chore: Bump jest from 26.0.1 to 26.1.0 chore: Update dist chore: Bump aws-sdk from 2.692.0 to 2.704.0 chore: Bump eslint from 7.2.0 to 7.3.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @billputer ! Code LGTM. Can you provide some test output or guidance on which workflows may trigger the original issue? I tried to reproduce by setting a status but no dice.
I'm specifically using the "deployment" webhook event. An external system creates a Deployment in GitHub which triggers our workflow. Here's a truncated version: name: deploy
on: ['deployment']
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
# ...rest of deploy code If you're interested in triggering that, here's roughly how we've been creating a GitHub Deployment in testing. npm install @octokit/rest
export GITHUB_TOKEN=<github_token_here>
node const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
userAgent: 'deploy testing',
})
octokit.repos.createDeployment({
owner: "billputer",
repo: "deploy-testing",
ref: "4cd8eff6e93378175f2d204ef5235cf2271d59d3",
description: "Deploy triggered by Bill via CLI",
environment: "testing",
task: "deploy",
payload: {},
required_contexts: [],
auto_merge: false,
}).then(data => { console.log(data) }); The key here is that the "ref" is a commit sha. If you instead pass a ref of "master", the GITHUB_REF environment variable is set. Let me know if that's helpful, or if you need any additional context. |
Fixes #80
Certain workflows don't set a GITHUB_REF variable, because the triggering event doesn't have a branch or tag, so this PR makes GITHUB_REF optional. This changes the ordering of tags in tests since the Branch tag is now added at the end. It also adds two tests to validate this behavior, although I'm not convinced they provide much value.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.