Skip to content

Commit

Permalink
chore: Update cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Oct 21, 2024
1 parent c29d19f commit f89cc79
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 41 deletions.
40 changes: 0 additions & 40 deletions .github/actions/get-pr-env/action.yaml

This file was deleted.

32 changes: 31 additions & 1 deletion .github/workflows/gh-pages-cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,35 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/get-pr-env
- uses: actions/github-script@v3
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: get pr env
id: pr-env
run: |
GIT_REPOSITORY=${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
PR_NUMBER=${{ fromJSON(steps.get-pr.outputs.result).number }}
LATEST_COMMIT_SHA=${{ fromJSON(steps.get-pr.outputs.result).head.sha }}
BRANCH_NAME=${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
echo "GIT_REPOSITORY=${GIT_REPOSITORY}" >> $GITHUB_OUTPUT
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "LATEST_COMMIT_SHA=${LATEST_COMMIT_SHA}" >> $GITHUB_OUTPUT
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Checkout code repository
uses: actions/checkout@v4
Expand All @@ -28,6 +55,9 @@ jobs:
- name: Log
run: |
echo "${{steps.pr-env.outputs.BRANCH_NAME}}"
echo "${{steps.pr-env.outputs.GIT_REPOSITORY}}"
echo "${{steps.pr-env.outputs.LATEST_COMMIT_SHA}}"
echo "${{steps.pr-env.outputs.PR_NUMBER}}"
- name: Creating .env
shell: bash
Expand Down

0 comments on commit f89cc79

Please sign in to comment.