#parcel/optimizer-css: missing field `analyzeDependencies` - parceljs

Action on gitHub pages.
When I tried to push app with this object
const iconCatalog = {
200: require('../image/animated/503-522-314-200-230d-rainy-day.svg'),
};
export default iconCatalog;
I have an error
#parcel/optimizer-css: missing field analyzeDependencies
If I change this object
const iconCatalog = {
'https://raw.githubusercontent.com/KsanaSal/weather-project-shecodes/main/src/image/animated/201-211-221d-thunderstorms-day.svg',
};
export default iconCatalog;
App deployed without any issues
this is my deploy.yml
name: Build and deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout#v2.3.1
- name: Install and Build 🔧
run: |
npm ci
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action#4.1.0
with:
branch: gh-pages
folder: dist
That is mean? I can't find solution on this. How and where I can add this missing field?

Related

"Can't find 'action.yml'" in reusable workflow

I have below structure:
.github
└── workflows
└── main.yml
└── send_alerts.yml
Now in main, I am using
jobs:
main:
steps:
- name: Git Checkout
uses: actions/checkout#v3
- name: some job
run: |
......
send_alerts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: ./.github/workflows/send_alerts.yml#feature/workflow1
with:
provision_status: "Success"
in my send_alerts.yml
name: Creating and Sending Alerts/Status
on:
workflow_call:
provision_status:
required: true
type: string
jobs:
create_send_alerts:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout#v3
- name: Some other jobs
run: |
.....
so this thorws me error:
Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/git-repo/.github/workflows/send_alerts.yml#feature/workflow1'. Did you forget to run actions/checkout before running your local action?
So my question is why it is complaining about action in send_alerts for main? while in the main.yml same actions/checkout#v3 works just fine?
I tried both actions/checkout#v2 and v3 in all cases I have same error
There are at least three things wrong:
You're calling a reusable workflow like an action. The call to a reusable workflow replaces the entire job, not just one step.
When you reference a workflow (or an action) that's in the same repository, with a relative path, you must not add an #version suffix. If you look at the error message, the runner is interpreting that as a directory name.
Both together result in something like this:
send_alerts:
uses: ./.github/workflows/send_alerts.yml
with:
provision_status: "Success"
You have to declare the parameter in an inputs object in the reusable workflow:
on:
workflow_call:
inputs:
provision_status:
required: true
type: string

github composite action error: An action could not be found at the URI

Created a github repo for a composite action, in the root of the repo i have a action.yml with the below code:
name: "semver-tag-release"
description: "Creates a semver release/tag on push to master"
runs:
using: "composite"
steps:
- name: Automated Version Bump
id: version-bump
uses: 'phips28/gh-action-bump-version#master'
env:
GITHUB_TOKEN: ${{ secrets.BYPASS }}
with:
skip-tag: 'false'
I added it to the existing push pipeline
name: Push
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: 'actions/checkout#v2'
with:
persist-credentials: false
fetch-depth: 50
- name: composite-semver-tag-release
uses: company/composite-semver-tag-release#0.1.4
When i run the push pipeline i get the error:
Download action repository 'company/composite-semver-tag-release#0.1.4' (SHA:dd280586e6409ee58fe59bd95d63dbefa19e2e13)
Error: An action could not be found at the URI 'https://api.github.com/repos/company/composite-semver-tag-release/tarball/dd280586e6409ee58fe59bd95d63dbefa19e2e13'
Any ideas on what im doing wrong?
My issue was that had the composite repo set to private. You have to make a public repo to use it as a composite (which im i dont really like to be honest)..
https://docs.github.com/en/actions/creating-actions/creating-a-composite-action#prerequisites
Prerequisites
Before you begin, you'll create a repository on GitHub.com.
Create a new public repository on GitHub.com.

Github action test if a commit containing a specific word was previously made

I need to make sure to test with github action, if a commit has previously been made that contains the word build.
If the commit does not contain the word build then tests with github action should not be run.
Can you give me some advice?
Test:
name: "Testing"
on:
push:
branches:
- master
jobs:
test_the_action:
name: Test the action
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout#v2
- uses: suisei-cn/actions-download-file#master
id: downloadfile
name: Download a file
with:
url: "[API Endpoint](https://api.github.com/repos/suisei-cn/actions-download-file)"
target: public/
auto-match: true
- name: Display the file
run: head -n8 public/actions-download-file
From a push event, it's possible to extract the commit message by using github.event.commit.message
Here is an example of the github context for a push event.
Note that if there are several commit messages:
commit[0] contains the oldest commit
${{ github.event.commits[0].message }}
head_commit contains the youngest commit
${{ github.event.head_commit.message }}
Then, you can check in your job if the commit message contains or not the word you want, for example by using:
if: "!contains(github.event.head_commit.message, 'build')"
Therefore, your workflow could look like this if you don't want the job to be run if the commit message contains the 'build' word:
name: "Testing"
on:
push:
branches:
- master
jobs:
test_the_action:
if: "!contains(github.event.head_commit.message, 'build')"
name: Test the action
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout#v2
- uses: suisei-cn/actions-download-file#master
id: downloadfile
name: Download a file
with:
url: "[API Endpoint](https://api.github.com/repos/suisei-cn/actions-download-file)"
target: public/
auto-match: true
- name: Display the file
run: head -n8 public/actions-download-file
Finally, you now also have the option to skip ci workflows with key words in the commit messages.

GitHub Actions get from API to create pull request

Is there a way to tell GitHub to automatically create a pull request from an API providing JSON content and merge it into my project?
I want to:
Edit files on a platform (I control the platform) using my own production editors/tools.
Have GitHub request it (REST), then create a PR or a commit, so people can collaborate on it with forks/GitHub project management.
Push from GitHub back to the platform for publishing.
3 is no problem, but 2 I can't find documentation for if it's even possible.
name: Manual workflow
on:
workflow_dispatch:
jobs:
makefiles:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout#v2
- name: Getting
uses: fjogeleit/http-request-action#master
id: myRequest
with:
url: 'https://domain/api/file'
method: 'GET'
- name: Show File
run: echo ${{ steps.myRequest.outputs.response }}
- name: Create A File
uses: 1arp/create-a-file-action#0.2
with:
path: 'src'
file: 'foo.bar'
content: ${{steps.myRequest.outputs.response}}
- name: final commit
uses: zwaldowski/git-commit-action#v1
id: git_commit
- name: show
run: echo "${{ steps.git_commit.outputs.sha }}"

How can I cancel a GitHub Actions workflow if the commit has no tag

I have npm publish github actions, I want to run this action if my commit has tag, otherwise I don't want to run my action because of that if I do not add any tag my commit then action is run and failed because it try to publish already publish npm package with same tag. For example with my last commit I have tag 1.2.3 and my npm package was publish with 1.2.3 version. When I add new commit to my branch without any tag actions try to publish my package with 1.2.3 version tag so it failed. Here my actions code below, is there any solution for it.
Thanks for advive.
name: NPM Publish
on:
push:
branches:
- master
tags:
- v*
jobs:
build:
name: Build 🏗 & Publish 🚀
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- uses: actions/setup-node#v2.4.0
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
I need something like that on yml file
if(git_commit has tag) continue job else stop job;
EDITTED VERSION
I edit my yml file base on #Enrico Campidoglio suggestion but still is does not work. I made two commit first one without tag and it canceled the action but second one has tag it still canceled action. Is there any new suggestion or solution ?
name: NPM Publish
on:
push:
branches:
- master
jobs:
build:
name: Build 🏗 & Publish 🚀
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- uses: actions/setup-node#v2.4.0
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: echo "GIT_COMMIT=`echo $(git rev-parse --short HEAD)`" >> $GITHUB_ENV
- run: echo "GIT_TAG=`echo $(git describe --tags --exact-match ${{ env.GIT_COMMIT }} || :)`" >> $GITHUB_ENV
- run: echo ${{ env.GIT_TAG }} != v*
- run: |
if [[ ${{ env.GIT_TAG }} == v* ]] ; then
echo "Tag found..."
else
echo "No git tag found, action cancelled..."
exit 1
fi
- uses: andymckay/cancel-action#0.2
if: ${{ env.GIT_TAG }} != v*
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
there is action result I cannot figure out what is the problem,
here the lastest failed action: https://github.com/sametcelikbicak/enum2array/runs/3513521031?check_suite_focus=true
I found the solution finally after too many tried. I changed my mind and try to run shell script and it works :)
Just add that line in my yml file
- name: Check Git Tag to continue publish
run: ./scripts/publish.sh
and I created a sh file for control the commit tag. You can find the latest script and yml file definitions below
Here is my lastest yml file, npm-publish.yml
name: NPM Publish
on:
push:
branches:
- master
jobs:
build:
name: Build 🏗 & Publish 🚀
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- uses: actions/setup-node#v2.4.0
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Check Git Tag to continue publish
run: ./scripts/publish.sh
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Here is my script file, publish.sh
#!/usr/bin/env bash
GIT_COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git describe --tags --exact-match $COMMIT || :)
if [[ ${GIT_TAG} == v* ]] ; then
echo "$GIT_TAG Tag found..."
else
echo "No git tag found, action cancelled..."
exit 1
fi
For the time being, there isn't an official action to cancel the current workflow. There is, however, an official GitHub API and a third-party action that invokes it. You could combine it with an if conditional and the github context to achieve what you want:
steps:
- uses: andymckay/cancel-action#0.2
if: startsWith(github.ref, 'refs/tags')
Be aware that cancelling a workflow through the API is an asynchronous operation, which means that later steps might still get executed until the workflow runner handles the request.
A much more solid approach would be to put a condition on your publishing step to only run when the workflow was triggered by a new tag:
steps:
- run: npm publish --access public
if: startsWith(github.ref, 'refs/tags')
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}