Skip to content

Commit

Permalink
use arg for github script
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanphan committed Jan 3, 2025
1 parent 05a78ce commit b718c56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,24 +267,24 @@ jobs:
uses: actions/github-script@v7
if: github.event.inputs.dry_run == 'false'
with:
github-token: ${{ secrets.GH_TAGGER_TOKEN }}
script: |
const octokit = github.getOctokit('${{ secrets.GH_TAGGER_TOKEN }}');
const refData = await octokit.rest.git.getRef({
const refData = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ inputs.git_ref }}'
});
if (refData.status !== 200) {
throw new Error('Failed to fetch existing tag');
}
await octokit.rest.git.createRef({
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.check_tag.outputs.program }}-${{ inputs.cluster }}',
sha: refData.data.object.sha
}).catch(err => {
if (err.status !== 422) throw err;
octokit.rest.git.updateRef({
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ needs.check_tag.outputs.program }}-${{ inputs.cluster }}',
Expand Down

0 comments on commit b718c56

Please sign in to comment.