Skip to content
name: Validate pip requirements-fixed.txt
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main-new-new
- '*'
paths:
- 'scripts/requirements*.txt'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.pull_request.number }}/head
path: ncs/nrf
fetch-depth: 0
- name: Determine PR Origin
id: pr-origin
run: |
echo "pr_repo_owner=${{ github.event.pull_request.head.repo.owner.login }}" >> $GITHUB_OUTPUT
- name: Commit and push changes
uses: actions/checkout@v3
working-directory: ncs/nrf
run: |
touch test
git config --global user.email "[email protected]"
git config --global user.name "NordicBuilder"
git add ./test
git commit -F- <<EOF
echo test12
Update requirements-fixed.txt from NordicBuilder
Automatically upload changed requirements-fixed.txt
Signed-off-by: Nordic Builder <[email protected]>
EOF
git remote set-url origin https://NordicBuilder:${{ secrets.NCS_GITHUB_TOKEN }}@github.com/${{ steps.pr-origin.outputs.pr_repo_owner }}/sdk-nrf-testing.git
git push origin HEAD:${{ github.head_ref }}
- name: Post summary
if: ${{ !cancelled() }}
run: |
if [[ "failure" == "${{ steps.diff.outcome }}" ]]; then
echo -e 'New requirements-fixed.txt file differs from the current file.
Please add the newly created file to the PR.' >> $GITHUB_STEP_SUMMARY
fi
if [[ -e ncs/requirements-fixed.txt ]]; then
echo -e '
<details>
<summary>requirements-fixed.txt</summary>
```' >> $GITHUB_STEP_SUMMARY
cat ncs/requirements-fixed.txt >> $GITHUB_STEP_SUMMARY
echo -e '```
</details>' >> $GITHUB_STEP_SUMMARY
else
echo -e 'Error during workflow, requirements-fixed file was not created' >> GITHUB_STEP_SUMMARY
fi