Skip to content

Remove 22 (#219)

Remove 22 (#219) #75

Workflow file for this run

name: Verify repository and generate tags
on:
push:
branches:
- main
jobs:
verify-repository-content:
name: Verify repository content
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.event.push.after }}
fetch-depth: 0
- name: Generate repository content from version
run: |
bash bin/update-dockerfiles.sh
git diff -R | tee ${GITHUB_WORKSPACE}/pr.diff
- name: Generate tags for pr
run: |
python3 bin/tag-generator.py | tee ${GITHUB_WORKSPACE}/.tags
- name: Add Comment to PR
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
//Determine if new comment is required and generate comment text
commentText = 'Contents for library/amazoncorretto:\n\n'
needNewComment = true;
console.log('Reviewing existing comments...');
console.log(context.sha);
for await (const { data: comments } of github.paginate.iterator(
github.rest.repos.listCommentsForCommit,
{
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
}
)) {
for (const comment of comments) {
if (comment.user.login === 'github-actions[bot]') {
if (needNewComment && comment.body.includes(commentText)) {
needNewComment = false;
} else {
console.log('Deleting comment: ' + comment.id);
await github.rest.repos.deleteCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
}
}
}
if (needNewComment) {
const fs = require('fs');
tags = fs.readFileSync(process.env.GITHUB_WORKSPACE + '/.tags').toString().trimEnd();
commentText = commentText + "<details>\n<summary>updated tags for [library/amazoncorretto](https://github.com/docker-library/official-images/blob/master/library/amazoncorretto)</summary>\n"
commentText = commentText + "\n```\nGitCommit: " + context.sha + "\n\n" + tags + "\n```\n</details>"
console.log('Creating new comment...');
await github.rest.repos.createCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
body: commentText,
});
}