Skip to content

Bump actions/upload-artifact from 4 to 6 #14

Bump actions/upload-artifact from 4 to 6

Bump actions/upload-artifact from 4 to 6 #14

Workflow file for this run

name: Test workflow
on:
pull_request: {}
push:
branches:
- "main"
permissions:
pull-requests: read
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Copy the action so that it can be used in the workflow
- name: Copy action
shell: bash
run: |
mkdir -p .github/actions/dependabot-changesets-action
cp action.yml .github/actions/dependabot-changesets-action/action.yml
# I'm sure this can be done in a more elegant way, but this will do for now
- name: Setup Maven Wrapper
shell: bash
run: |
cat >pom.xml <<EOL
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>se.fortnox</groupId>
<artifactId>test-pom</artifactId>
<version>1-SNAPSHOT</version>
</project>
EOL
mkdir -p .mvn/wrapper
cat >.mvn/wrapper/maven-wrapper.properties <<EOL
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip
EOL
wget https://repo1.maven.org/maven2/org/apache/maven/wrapper/maven-wrapper-distribution/3.3.2/maven-wrapper-distribution-3.3.2-bin.zip
unzip maven-wrapper-distribution-3.3.2-bin.zip
./mvnw -v
- # noinspection UndefinedAction
uses: ./.github/actions/dependabot-changesets-action
# These are for testing without having a real Dependabot PR to extract the metadata from
env:
DEPENDENCY_NAMES: com.opencsv:opencsv
NEW_VERSION: 5.11.1
- uses: actions/upload-artifact@v6
with:
name: changeset-folder
include-hidden-files: true
path: .changeset
# The Maven plugin has its own tests for creating changesets, so this is just a simple validation
# to verify that the action is run with the correct parameters and that the changeset file is created correctly.
- name: Validate
shell: bash
run: |
FILE=.changeset/dependabot-${GITHUB_SHA::7}.md
if [ ! -f $FILE ]; then
echo "Changeset file $FILE not found"
exit 1
fi
if ! grep -q -- "\"test-pom\": patch" $FILE; then
echo "Does not contain module and level"
exit 1
fi;
if ! grep -q -- "- com.opencsv:opencsv: 5.11.1" $FILE; then
echo "Does not contain dependency and version"
exit 1
fi;
echo "Changeset file created successfully"
cat $FILE || true