Skip to content

Commit

Permalink
use json
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Sep 27, 2023
1 parent 9d86579 commit 3cb144e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,18 @@ jobs:
id: get_pr_info
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const { data: pr } = await github.rest.pulls.get({
await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ inputs.pr_number }}
});
const sourceRepo = pr.head.repo.full_name;
const sourceBranch = pr.head.ref;
const sourceJSON = `{ 'source': { 'repo': '${sourceRepo}', 'branch': '${sourceBranch}' } }`;
return sourceJSON;
- name: Set source branch from PR number
if: ${{ github.event_name == 'workflow_dispatch' && inputs.pr_number != '' }}
run: |
echo "SOURCE_REPO=${{ fromJSON(steps.get_pr_info.outputs.result.source.repo) }}" >> $GITHUB_ENV
echo "SOURCE_BRANCH=${{ fromJSON(steps.get_pr_info.outputs.result.source.branch) }}" >> $GITHUB_ENV
echo "SOURCE_REPO=${{ fromJSON(steps.get_pr_info.outputs.result.head.repo.full_name) }}" >> $GITHUB_ENV
echo "SOURCE_BRANCH=${{ fromJSON(steps.get_pr_info.outputs.result.head.ref) }}" >> $GITHUB_ENV
- name: Find Comment
uses: peter-evans/find-comment@v2
Expand Down

0 comments on commit 3cb144e

Please sign in to comment.