Skip to content

Try adding diff check #1

Try adding diff check

Try adding diff check #1

Workflow file for this run

name: Opdrachten Team Dependabot
on:
workflow_call:
inputs:
check_diff:
description: 'Check major upgrades. Requires the Makefile target "diff"'
type: boolean
default: false
run_tests:
description: 'Run tests. Requires the Makefile targets "build", "pull", "push" and "test"'
type: boolean
default: false
slack_channel:
description: 'Slack channel'
type: string
required: true
timetell_code:
description: 'Timetell project id'
type: number
acceptance_pipeline:
description: 'Acceptance pipeline'
type: string
production_pipeline:
description: 'Production pipeline'
type: string
acceptance_urls:
description: 'Acceptance urls'
type: string
production_urls:
description: 'Production urls'
type: string
jobs:
update-dependencies:
name: Update Dependencies
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: amsterdam/opdrachten-team-github-workflows/ghcr-login@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.repository.default_branch }}
- name: Update dependencies file
run: make requirements
- name: Docker build and push to GHCR
if: ${{ inputs.run_tests == 'true' }}
uses: amsterdam/opdrachten-team-github-workflows/build-and-push@v1
- name: Run Tests
if: ${{ inputs.run_tests == 'true' }}

Check failure on line 53 in .github/workflows/dependabot.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dependabot.yml

Invalid workflow file

You have an error in your yaml syntax on line 53
run: make test
- name: Construct variables
id: variables
run: |
today=$(date +'%Y-%m-%d')
echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
title="Maintenance run $today"
title_html=$(echo $title | sed 's/ /%20/g')
echo "title=$title" >> $GITHUB_OUTPUT
# Increment minor version of last tag. Use 1.0.0 if there is no latest_tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
next_tag=$(echo $latest_tag | awk -F. -v OFS=. '{$NF = $NF + 1;} 1' || echo "1.0.0")
echo "next_tag=$next_tag" >> $GITHUB_OUTPUT
echo "release_url=${{ github.event.repository.html_url }}/releases/new?tag=$next_tag&title=$title_html" >> $GITHUB_OUTPUT
- name: Print variables
run: |
echo "Today is ${{ steps.variables.outputs.today }}"
echo "Title is ${{ steps.variables.outputs.title }}"
echo "Latest tag is ${{ steps.variables.outputs.latest_tag }}"
echo "Next tag is ${{ steps.variables.outputs.next_tag }}"
echo "Release url is ${{ steps.variables.outputs.release_url }}"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
title: ${{ steps.variables.outputs.title }}
labels: Opdrachten Team Dependabot
body: |
Auto generated PR to update dependencies.
This PR is generated by the Opdrachten Team Dependabot
branch: dependabot/${{ steps.variables.outputs.today }}
committer: Opdrachten Team Dependabot <opdrachten-team-dependabot@amsterdam.nl>
commit-message: ${{ steps.variables.outputs.title }}
- name: Check if SLACK_TOKEN exists
env:
slack_token: ${{ secrets.SLACK_TOKEN }}
if: ${{ env.slack_token == '' }}
run: |
echo "The secret \"SLACK_TOKEN\" has not been created; please go to \"settings > secrets > actions\" to create it"
exit 1
- name: Check Major Upgrades
shell: sh
if: ${{ inputs.check_diff }}
id: diff_checker
run: |
export DIFF=$(make diff)
if [ -z "$DIFF" ]; then
echo "No major upgrades found"
echo "diff=No major upgrades found" >> $GITHUB_OUTPUT
else
echo "Major upgrades found"
echo "$DIFF"
{
echo 'DIFF<<EOF'
echo "$DIFF"
echo EOF
} >> "$GITHUB_ENV"
fi
- name: Write message to slack
uses: amsterdam/opdrachten-team-github-workflows/slack-message@v1
with:
slack-token: ${{ secrets.SLACK_TOKEN }}
slack-channel: ${{ inputs.slack_channel }}
message: ${{ env.DIFF }}
pull-request-url: ${{ steps.cpr.outputs.pull-request-url }}
acceptance_pipeline: ${{ inputs.acceptance_pipeline }}
production_pipeline: ${{ inputs.production_pipeline }}
acceptance_urls: ${{ inputs.acceptance_urls }}
production_urls: ${{ inputs.production_urls }}
timetell_code: ${{ inputs.timetell_code }}
release_url: ${{ steps.variables.outputs.release_url }}