Skip to content

Commit

Permalink
Determine branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wdbasson committed Jan 31, 2024
1 parent a92ea02 commit 08db7bc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/continuous-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,22 @@ jobs:
with:
script: |
const { GITHUB_TOKEN } = process.env;
const { context } = require('@actions/github');
const github = require('@actions/github').getOctokit(GITHUB_TOKEN);
const branch = context.ref.replace('refs/heads/', '');
const githubContext = require('@actions/github').context;
const octokit = require('@actions/github').getOctokit(GITHUB_TOKEN);
const branchName = githubContext.ref.replace('refs/heads/', '');
try {
await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: branch,
await octokit.rest.repos.getBranch({
owner: githubContext.repo.owner,
repo: githubContext.repo.repo,
branch: branchName,
});
return branch;
return branchName;
} catch (error) {
return 'master';
}
- name: Checkout Charts
uses: actions/checkout@v4
with:
Expand Down

0 comments on commit 08db7bc

Please sign in to comment.