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 7678917
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions .github/workflows/continuous-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,34 +332,32 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Determine branch
id: set_branch
uses: actions/github-script@v5
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/', '');
try {
await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: branch,
});
return branch;
} catch (error) {
return 'master';
}
# - name: Determine branch
# id: set_branch
# uses: actions/github-script@v5
# with:
# script: |
# const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
# const octokit = require('@actions/github').getOctokit(GITHUB_TOKEN);
# const branchName = process.env.GITHUB_REF.replace('refs/heads/', '');
# try {
# await octokit.rest.repos.getBranch({
# owner: process.env.GITHUB_REPOSITORY_OWNER,
# repo: (process.env.GITHUB_REPOSITORY).split('/')[1],
# branch: branchName,
# });
# return branchName;
# } catch (error) {
# return 'master';
# }

- name: Checkout Charts
uses: actions/checkout@v4
with:
repository: didx-xyz/charts
token: ${{ secrets.PAT }}
path: charts
ref: ${{ steps.set_branch.outputs.result }}

# ref: ${{ steps.set_branch.outputs.result }}

- name: Install dependencies
run: sudo apt-get install -y postgresql-client redis-tools
Expand Down

0 comments on commit 7678917

Please sign in to comment.