Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ref: github.event.pull_request.head.sha to actions checkout in … #855

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .github/workflows/check_license_and_history.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Check License and History

on: # this workflow is planned to be called by the ci_pipeline and it will compare the PR files with the main
on:
workflow_call:
workflow_dispatch:
push:
Expand All @@ -17,27 +17,23 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Get changed files
id: changes
run: |
echo ${{github.event.pull_request.head.repo.full_name}}
if [ "${{ github.event.pull_request.head.repo.full_name }}" == "speedb-io/speedb" ]; then
echo "files added or changed in a PR that came from the speedb repo: "
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- . ':!.github' ':!*.md'
echo "diff_list<<EOF" >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- . ':!.github' ':!*.md' >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=ACMRT remotes/origin/main HEAD -- . ':!.github' ':!*.md' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "added or changed files: "
git diff --name-only --diff-filter=ACMRT remotes/origin/main HEAD -- . ':!.github' ':!*.md'
echo "diff_list<<EOF" >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=ACMRT remotes/origin/main HEAD -- . ':!.github' ':!*.md' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
echo "files added or changed in a PR: "
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- . ':!.github' ':!*.md'
echo "added or changed files: "
git diff --name-only --diff-filter=ACMRT remotes/origin/main HEAD -- . ':!.github' ':!*.md'
echo "diff_list<<EOF" >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- . ':!.github' ':!*.md' >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=ACMRT remotes/origin/main HEAD -- . ':!.github' ':!*.md' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: list new files
run: |
echo "New files in this PR ${{ steps.changes.outputs.diff_list }}"

lint:
runs-on: ubuntu-latest
needs: changedfiles
Expand All @@ -48,6 +44,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Check License
run: |
exit_code=0
Expand All @@ -59,7 +56,6 @@ jobs:
done
exit $exit_code
- name: Check HISTORY PR
if: github.event.pull_request.head.repo.full_name == 'speedb-io/speedb'
run: |
set +e
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}|grep -v "\.github" |grep -q [a-z,A-Z]
Expand Down Expand Up @@ -91,4 +87,4 @@ jobs:
exit $history_not_in
fi
echo "No files were added"
exit 0
exit 0
Loading