Skip to content

Commit

Permalink
Merge pull request #293 from ShotaroMatsuya:test/test-1
Browse files Browse the repository at this point in the history
test
  • Loading branch information
ShotaroMatsuya authored Aug 28, 2024
2 parents f5467a2 + 74d7c86 commit 10cce2e
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/test_changed_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,37 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Get PR details
id: get_pr
uses: actions/github-script@v6
- uses: actions/github-script@v6
id: set-target-branch
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const pr_url = github.event.issue.pull_request.url;
const pr = await github.request(`GET ${pr_url}`, {
headers: {
authorization: `token ${process.env.GITHUB_TOKEN}`
}
});
return { base_ref: pr.data.base.ref, head_ref: pr.data.head.ref };
const pull_request = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
return {head_ref: pull_request.data.head.ref, base_ref: pull_request.data.base.ref}
- name: Output refs
if: steps.get_pr.outputs.base_ref != ''
if: steps.set-target-branch.outputs.base_ref != ''
run: |
echo "Base ref: ${{ steps.get_pr.outputs.base_ref }}"
echo "Head ref: ${{ steps.get_pr.outputs.head_ref }}"
echo "Base ref: ${{ steps.set-target-branch.outputs.base_ref }}"
echo "Head ref: ${{ steps.set-target-branch.outputs.head_ref }}"
- uses: actions/checkout@v4
name: checkout "${{ steps.get_pr.outputs.base_ref }}"
name: checkout "${{ steps.set-target-branch.outputs.base_ref }}"
with:
fetch-depth: 1
ref: ${{ steps.get_pr.outputs.base_ref }}
ref: ${{ steps.set-target-branch.outputs.base_ref }}
- uses: actions/checkout@v4
name: checkout "${{ steps.get_pr.outputs.head_ref }}"
name: checkout "${{ steps.set-target-branch.outputs.head_ref }}"
with:
fetch-depth: 1
ref: ${{ steps.get_pr.outputs.head_ref }}
ref: ${{ steps.set-target-branch.outputs.head_ref }}
- name: check_diff
shell: bash
run: |
files=(`git diff origin/${{ steps.get_pr.outputs.base_ref }} --name-only|tr '\n' ' ' `)
files=(`git diff origin/${{ steps.set-target-branch.outputs.base_ref }} --name-only|tr '\n' ' ' `)
for file in ${files[@]}; do
echo ${file}
done

0 comments on commit 10cce2e

Please sign in to comment.