Conversation
…the future but this works for now
assignUser
left a comment
There was a problem hiding this comment.
Some comments, will have another look later
asciidoc/action.yml
Outdated
| git status | ||
| if git commit -m "Commit build products" | ||
| then | ||
| git push |
There was a problem hiding this comment.
I'm pretty sure this will fail as you are not setting up auth via actions/checkout or something.
There was a problem hiding this comment.
this was pulled from the pelican action and has been tested against the infrastructure-presentations repo
There was a problem hiding this comment.
I assume the workflow using the pelican action called actions/checkout then.
You could make it a usage requirement to use this within an existing checkout but that should be documented specifically requiring that persist-credentials: is set to true otherwise this will fail.
There was a problem hiding this comment.
I think calling the input publish instead of pushToBranch is unfortunate.
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: actions/setup-node@v4 |
There was a problem hiding this comment.
| - uses: actions/setup-node@v4 | |
| - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 |
While it's an offical action and this doesn't require pinning in workflows I think it still makes sense within an action as the user has no control over it?
There was a problem hiding this comment.
would there be a way to test this / keep this hash up to date with dependabot or something? Trying to prevent having to touch this everytime there's an update.
There was a problem hiding this comment.
yes dependabot can do it, just add the dir with action.yml to the directories list in dependabot.yml
There was a problem hiding this comment.
I would pin all actions also the ones coming from GitHub. The positive side effect is that your action does not have uncertainty wrt which exact action is being used. We have seen in the past that sometimes bugs are introduces in newly released versions and when you use just @v4 you will always get the latest released version of the v4 branch of that action. Having it pinned to an exact version makes actions more stable imho.
There was a problem hiding this comment.
btw. you can use https://github.com/eclipse-csi/octopin for pinning.
install with pipx install octocpin
| if [[ "$(echo $file | awk -F. '{print $NF}')" != "adoc" ]]; then | ||
| continue | ||
| fi | ||
| echo $file |
There was a problem hiding this comment.
Does this not make the output very noisy? Maybe use groups to structure the log see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines
There was a problem hiding this comment.
This was all ripped from the pelican action. If there's a better / more GHA way to approach this, I'm 100% interested.
asciidoc/action.yml
Outdated
| fi | ||
| echo $file | ||
| node convert-slides.js $file | ||
| mv $(basename $file .adoc).html "${{ inputs.tempdir }}"/ |
There was a problem hiding this comment.
| mv $(basename $file .adoc).html "${{ inputs.tempdir }}"/ | |
| mv $(basename $file).html "${{ inputs.tempdir }}"/ |
Or did that serve a purpose there? I think it would just be dropped?
There was a problem hiding this comment.
the basename command requires a suffix to strip.
There was a problem hiding this comment.
ah that makes sense, if never needed that before :D
|
The name of this action is not precise. Asciidoc is a markdown format and can be used for writing books, READMEs or as in this case presentation slides with the reveal framework. So a better name for the action would probably be "presentations" or "slides" or "revealjs" or similar. |
assignUser
left a comment
There was a problem hiding this comment.
Please also create a workflow to test the action with some sample input and some different options (obv publish is hard to test, we could create a test branch?).
You can also add npm to dependabot with asciidoc as a directory:
- package-ecosystem: "npm"
directory: "/asciidoc/"
schedule:
interval: "monthly"| cp "${{ github.action_path }}/package.json" "${{ inputs.tempdir }}" | ||
| [ -d "${{ github.workspace }}/${{ inputs.assets }}" ] && cp -r "${{ github.workspace }}/${{ inputs.assets }}" "${{ inputs.tempdir }}" || echo "No ${{ inputs.assets }} found!" | ||
| working-directory: "${{ inputs.srcdir }}" | ||
|
|
There was a problem hiding this comment.
I would add an actions/upload-artifact step here if: ${{ inputs.publish != 'true' }} (or rather if: inputs.publish if you make it a boolean. I'll add a comment above).
That way you could check the created artifacts when running the action in a PR or something. (and we can use it in testing)
There was a problem hiding this comment.
you can use to if: toJSON(inputs.publish) or something like that
|
@janhoy: Thanks for the suggestion! I'll update it to asciidoc-slides |
Co-authored-by: Jacob Wujciak-Jens <jacob@wujciak.de> Signed-off-by: dfoulks1 <48735727+dfoulks1@users.noreply.github.com>
dfoulks1
left a comment
There was a problem hiding this comment.
responding to comments
| if [[ "$(echo $file | awk -F. '{print $NF}')" != "adoc" ]]; then | ||
| continue | ||
| fi | ||
| echo $file |
There was a problem hiding this comment.
This was all ripped from the pelican action. If there's a better / more GHA way to approach this, I'm 100% interested.
asciidoc/action.yml
Outdated
| fi | ||
| echo $file | ||
| node convert-slides.js $file | ||
| mv $(basename $file .adoc).html "${{ inputs.tempdir }}"/ |
There was a problem hiding this comment.
the basename command requires a suffix to strip.
asciidoc/action.yml
Outdated
| git status | ||
| if git commit -m "Commit build products" | ||
| then | ||
| git push |
There was a problem hiding this comment.
this was pulled from the pelican action and has been tested against the infrastructure-presentations repo
…ctions into dfoulks/asciidoc
| ) | ||
| working-directory: "${{ github.action_path }}" | ||
|
|
||
| - name: |
asciidoc/action.yml
Outdated
| - name: | ||
| shell: bash | ||
| run: | | ||
| mkdir "${{ inputs.tempdir }}" |
There was a problem hiding this comment.
| mkdir "${{ inputs.tempdir }}" | |
| : 'Some name for this step -- the same as the `name:` field -- so that users see this instead of just the first rather useless line of the step when looking at a workflow' | |
| mkdir "${{ inputs.tempdir }}" |
asciidoc/action.yml
Outdated
| fi | ||
| echo $file | ||
| node convert-slides.js $file | ||
| mv $(basename $file .adoc).html "${{ inputs.tempdir }}"/ |
There was a problem hiding this comment.
Never use ${{ ... }} inside a run: block.
Always use:
env:
tempdir: ${{ inputs.tempdir }}
run: |
...
echo "$tempdir"
| cp "${{ github.action_path }}/package.json" "${{ inputs.tempdir }}" | ||
| [ -d "${{ github.workspace }}/${{ inputs.assets }}" ] && cp -r "${{ github.workspace }}/${{ inputs.assets }}" "${{ inputs.tempdir }}" || echo "No ${{ inputs.assets }} found!" | ||
| working-directory: "${{ inputs.srcdir }}" | ||
|
|
There was a problem hiding this comment.
you can use to if: toJSON(inputs.publish) or something like that
asciidoc/action.yml
Outdated
| git status | ||
| if git commit -m "Commit build products" | ||
| then | ||
| git push |
There was a problem hiding this comment.
I think calling the input publish instead of pushToBranch is unfortunate.
…the output dir around
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: '${{ inputs.srcdir }}/${{ inputs.output }}' | ||
| - name: Deploy to GitHub Pages[ |
There was a problem hiding this comment.
seems like a typo at the end '[' ?
Requesting to add the AsciiDoc action (builds Asciidoc files and commits to perscribed branch)
Uses
Process
$srcfiles$assetsto tempdir.$dest branch