Skip to content

Commit

Permalink
[FIXUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Sep 12, 2024
1 parent bc254e5 commit 42b0c6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/checkVersions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ on:
required: false
#TODO: revise inputs once done

permissions:
contents: read
issues: write
permissions: read-all

jobs:
versions-check-and-increment:
name: Check and increment service versions
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
run: echo '${{ toJSON(github) }}'

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
#with:
Expand Down Expand Up @@ -81,20 +81,9 @@ jobs:
git status
git commit -m "Bump version(s) for ${streamVersion} stream"
#fileList=$(git diff-tree --no-commit-id --name-only HEAD -r)
#echo "file-list<<EOF" >> $GITHUB_OUTPUT
#echo "$fileList" >> $GITHUB_OUTPUT
#echo "EOF" >> $GITHUB_OUTPUT
git format-patch -1 HEAD --no-stat --output 'version_increments.patch'
# --no-prefix
#git remote add 'fork' https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git
#git remote -v
#git push 'fork' 'HEAD:refs/heads/${{ github.event.pull_request.head.ref }}'
#git push \
# "https://oauth2:${BOT_TOKEN}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git" \
# 'HEAD:refs/heads/${{ github.event.pull_request.head.ref }}'
else
echo 'No versions have to be incremented'
fi
Expand All @@ -103,6 +92,3 @@ jobs:
with:
name: versions-git-patch
path: version_increments.patch

# TODO: Add an FAQ about version bumps?
# TODO: make comment updatable
28 changes: 14 additions & 14 deletions .github/workflows/publishVersionCheckResults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ on:

# TODO: check if we can derive some inputs from the original workflow or the git-patch

permissions: {}
permissions: read-all
#permissions: {}

jobs:
versions-check-result:
name: Publish Version Check Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
checks: write
pull-requests: write
contents: read
issues: read
actions: read
# permissions:
# checks: write
# pull-requests: write
# contents: read
# issues: read
# actions: read

steps:
- name: Dump GitHub context
Expand All @@ -41,11 +42,11 @@ jobs:
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
...context.repo
});
return allArtifacts.data.artifacts.find(artifact => artifact.name == 'versions-git-patch')
let artifact = allArtifacts.data.artifacts.find(artifact => artifact.name == 'versions-git-patch')
return artifact?.id
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: steps.search-git-patch.outputs.result
Expand All @@ -59,12 +60,11 @@ jobs:
if: steps.search-git-patch.outputs.result
with:
script: |
let matchArtifact = ${{ steps.search-git-patch.outputs.result }}
let matchArtifactId = ${{ steps.search-git-patch.outputs.result }}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
artifact_id: matchArtifactId,
archive_format: 'zip',
...context.repo
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/patch.zip`, Buffer.from(download.data));
Expand Down

0 comments on commit 42b0c6f

Please sign in to comment.